security error accessing a file

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ilKaos

    security error accessing a file

    hi all.
    I have a script that tries to open a file that is on a different folder than
    the one in which i am working.
    that is the script:

    openmydoc= "file://///192.168.1.1/web/" + type+ "/" + year+ "/" + Month+
    "/myfile.xyz" ;
    open(openmydoc) ;


    the proble is that on the javascript console i have a message that alerts me
    about a security error.
    it says "content at http://192.168.1.1/myfldr/mydoc.htm may not load or link
    to file:///// 192.168.1.1/web/..."
    but if I try to open my link writing by hand the address
    file://///192.168.1.1/web/... it works.
    the server is apache.
    any idea about how to handle this?
    tia.


  • Erwin Moller

    #2
    Re: security error accessing a file

    ilKaos wrote:
    [color=blue]
    > hi all.
    > I have a script that tries to open a file that is on a different folder
    > than the one in which i am working.
    > that is the script:
    >
    > openmydoc= "file://///192.168.1.1/web/" + type+ "/" + year+ "/" + Month+
    > "/myfile.xyz" ;
    > open(openmydoc) ;
    >
    >
    > the proble is that on the javascript console i have a message that alerts
    > me about a security error.
    > it says "content at http://192.168.1.1/myfldr/mydoc.htm may not load or
    > link to file:///// 192.168.1.1/web/..."
    > but if I try to open my link writing by hand the address
    > file://///192.168.1.1/web/... it works.
    > the server is apache.
    > any idea about how to handle this?
    > tia.[/color]


    Hi,

    The first argument for window.open (url, target, etc.etc..)
    is url.

    A URL starts with http://
    NOT with file://

    You feed something different. (a file on a share somewhere)
    What do you expect Javascript to do excactly?
    (Javascript cannot open files on a filesystem.)

    If the file://///192.168.1.1/web/etcetc is also reachable via http, I
    suggest you use that route.

    SO if the content of your share is also reachable via a webserver, figure
    out the URL, and use that.

    Regards,
    Erwin Moller

    Comment

    • ilKaos

      #3
      Re: security error accessing a file

      >[color=blue]
      > Hi,
      >[/color]

      first of all, thanks for your kind answer.

      [color=blue]
      > The first argument for window.open (url, target, etc.etc..)
      > is url.
      >
      > A URL starts with http://
      > NOT with file://
      >[/color]
      i thought it could work even with file...my mistake.
      [color=blue]
      > You feed something different. (a file on a share somewhere)
      > What do you expect Javascript to do excactly?
      > (Javascript cannot open files on a filesystem.)[/color]

      that (of course) is just what i need...
      [color=blue]
      >
      > If the file://///192.168.1.1/web/etcetc is also reachable via http, I
      > suggest you use that route.
      >[/color]
      [color=blue]
      > SO if the content of your share is also reachable via a webserver, figure
      > out the URL, and use that.
      >
      > Regards,
      > Erwin Moller[/color]


      you mean by having somethnig like http://192.168.1.1/web/etc/mtyfile.xyz?
      it works, but the problem is that it does not open the file with the
      appropriate plugin but rather tries to
      open it with the browser itself. this does not happen if i refer to the file
      with file://///192.168...

      maybe i should specify something at the "apache level" to make the browser
      capable of understanding to open
      the file with the appropriate plugin? something like mim type
      xyz/use_my_plugin ?

      thanks again.


      Comment

      • Erwin Moller

        #4
        Re: security error accessing a file

        ilKaos wrote:
        [color=blue][color=green]
        >>
        >> Hi,
        >>[/color]
        >
        > first of all, thanks for your kind answer.
        >[/color]

        You are welcome. :-)
        [color=blue]
        >[color=green]
        >> The first argument for window.open (url, target, etc.etc..)
        >> is url.
        >>
        >> A URL starts with http://
        >> NOT with file://
        >>[/color]
        > i thought it could work even with file...my mistake.[/color]

        The fact that a browser (sometimes) opens a file for you (when you point to
        it by just typing the location into the URL) probably mislead you in
        thinking that that is a normal procedure.
        (But it is not)
        [color=blue]
        >[color=green]
        >> You feed something different. (a file on a share somewhere)
        >> What do you expect Javascript to do excactly?
        >> (Javascript cannot open files on a filesystem.)[/color]
        >
        > that (of course) is just what i need...
        >[color=green]
        >>
        >> If the file://///192.168.1.1/web/etcetc is also reachable via http, I
        >> suggest you use that route.
        >>[/color]
        >[color=green]
        >> SO if the content of your share is also reachable via a webserver, figure
        >> out the URL, and use that.
        >>
        >> Regards,
        >> Erwin Moller[/color]
        >
        >
        > you mean by having somethnig like http://192.168.1.1/web/etc/mtyfile.xyz?[/color]

        yes.
        [color=blue]
        > it works, but the problem is that it does not open the file with the
        > appropriate plugin but rather tries to
        > open it with the browser itself. this does not happen if i refer to the
        > file with file://///192.168...
        >
        > maybe i should specify something at the "apache level" to make the browser
        > capable of understanding to open
        > the file with the appropriate plugin? something like mim type
        > xyz/use_my_plugin ?[/color]

        I don't think you have to fiddle with apache to get it done.

        But I am not sure what file you are trying to load.

        Try this:
        1) figure out the URL http://192etcetc to the file you need in Javascript.
        2) Try to feed that URL to the object/embed you are using on your page.

        A simple example with an image (based on some var named month):
        var myImageLocation = "http://192.168.1.1/web/"+month+"/serverload.gif" ;

        document.images["servloadim age"].src=myImageLoc ation;

        And somewhere in you document:
        <img src="default.gi f" name="servloadi mage">

        Try to do the same with the object/embed you are using.
        If you don't know the excact syntax, google for it.
        (Tip: ALso try google groups to search all the newsgroupsposti ngs in the
        past)

        Good luck!

        Regards,
        Erwin Moller
        [color=blue]
        >
        > thanks again.[/color]

        Comment

        • ilkaos

          #5
          Re: security error accessing a file

          [color=blue]
          > Try to do the same with the object/embed you are using.
          > If you don't know the excact syntax, google for it.
          > (Tip: ALso try google groups to search all the newsgroupsposti ngs in the
          > past)
          >
          > Good luck!
          >
          > Regards,
          > Erwin Moller
          >[/color]

          again, thanks a lot for your kind answer.
          i will try what you suggest as soon as possible.
          as you probably understood i am not deep in javascript but just using it
          in some of the web pages that i am creating with cgi and iseries(as400).

          the file that i need to open is an .afp (ibm print format), there is a
          plugin that seem to
          work only with Ie (and with the conditions i explained in the above
          messages).
          i am new to js but not so newbie not to try a research with google groups (i
          wrote in usenet
          since '96 and used deja/google groups since then).
          but the problem is that not so many people seem to open afp files from a
          web page, or at least they
          do not seem to use the web/usenet to help poor guy like me...

          hope that your suggestion will work and in any case they were important for
          me to
          understand some of the js concepts.
          thanks and "ciao".



          Comment

          • Robert

            #6
            Re: security error accessing a file

            In article <34po4sF4a5i3uU 1@individual.ne t>,
            "ilkaos" <12wre12wq2@kat amail.it> wrote:
            [color=blue]
            > the file that i need to open is an .afp (ibm print format), there is a
            > plugin that seem to
            > work only with Ie (and with the conditions i explained in the above
            > messages).[/color]

            My understanding is this:
            1) you put in a link to your file <a> </a> tag. It's just like a link to
            a web page except the name is different.
            2) web server serves up file with the correct mime type
            3) browser gets the returning file.
            4) Browser decides what to do. If there is a plug in for the file, the
            plug in get control. If plug in isn't there, browser decides what to do.

            Robert

            Comment

            Working...