Problem with loading image in FF-Win

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

    Problem with loading image in FF-Win

    The statement:

    myImage.src = "wiggy.jpg" ;

    appears to be a no-operation in FireFox 2.0.0.14 under XP. Works fine in
    IE7 (XP) and on the Mac under Safari and FF.

    myImage points to an <img ...and wiggy.jpg is in the same directory as
    the HTML file (a network mount, from which all these browsers were
    accessing it).

    I did read somewhere that JS is not supposed to have access to the local
    filesystem and therefore the operation should be disallowed anyway,
    however, this sort of operation seems to be widespread. See, e.g.:



    Any pointers welcome.
  • Martin Honnen

    #2
    Re: Problem with loading image in FF-Win

    Tim Streater wrote:
    The statement:
    >
    myImage.src = "wiggy.jpg" ;
    >
    appears to be a no-operation in FireFox 2.0.0.14 under XP. Works fine in
    IE7 (XP) and on the Mac under Safari and FF.
    >
    myImage points to an <img ...and wiggy.jpg is in the same directory as
    the HTML file (a network mount, from which all these browsers were
    accessing it).
    If FF on the Mac works then it is hard to tell why it does not work with
    FF on Win. Have you checked with DOM inspector that the src property is
    indeed changed? Have you checked the error console (just to make sure
    there is no script error or security problem shown)?


    --

    Martin Honnen

    Comment

    • Tim Streater

      #3
      Re: Problem with loading image in FF-Win

      In article <4835682f$0$677 8$9b4e6d93@news spool2.arcor-online.net>,
      Martin Honnen <mahotrash@yaho o.dewrote:
      Tim Streater wrote:
      The statement:

      myImage.src = "wiggy.jpg" ;

      appears to be a no-operation in FireFox 2.0.0.14 under XP. Works fine in
      IE7 (XP) and on the Mac under Safari and FF.

      myImage points to an <img ...and wiggy.jpg is in the same directory as
      the HTML file (a network mount, from which all these browsers were
      accessing it).
      >
      If FF on the Mac works then it is hard to tell why it does not work with
      FF on Win.
      Quite!
      Have you checked with DOM inspector that the src property is
      indeed changed?
      To get this I re-installed FF. My <imghas no src attribute under XP.
      FF-Mac shows the expected value for this attribute.

      If I give the <imgan src attribute in the source, giving some
      non-existent file, then that is what show up in the DOM inspector.
      Setting it to something else has no effect - the src attribute is
      unaltered.
      Have you checked the error console (just to make sure
      there is no script error or security problem shown)?
      Yes - the error console shows nothing.

      Clutching at straws I requested colleagues to try it - and for them,
      with FF under XP, it works. So it looks like it's limited to my PC, but
      I'm damned if I can see why.

      Comment

      • =?ISO-8859-1?Q?=22=C1lvaro_G=2E_Vicario=22?=

        #4
        Re: Problem with loading image in FF-Win

        Tim Streater escribió:
        The statement:
        >
        myImage.src = "wiggy.jpg" ;
        >
        appears to be a no-operation in FireFox 2.0.0.14 under XP. Works fine in
        IE7 (XP) and on the Mac under Safari and FF.
        >
        myImage points to an <img ...and wiggy.jpg is in the same directory as
        the HTML file (a network mount, from which all these browsers were
        accessing it).
        >
        I did read somewhere that JS is not supposed to have access to the local
        filesystem and therefore the operation should be disallowed anyway,
        however, this sort of operation seems to be widespread. See, e.g.:
        >
        http://www.webdevelopersnotes.com/tips/html/42.php3
        In a previous message you asked advice on how to insert a picture from
        the client file system in a page from an Internet site. This article
        talks about rollovers, which has absolutely nothing to do with it.

        Firefox does allow to dynamically change the src attribute of an <img>
        tag. But it won't display a client image in a server document, not even
        statically:

        <img src="file:///C:/Foo/tmp/paisaje01.jpg" width="100" height="100"
        alt="" title="">

        This works locally but not once you publish the page. If plain HTML
        won't allow it, there's no point in generating that HTML with JavaScript.

        I'm not sure if you can circumvent it with iframes or any other trick,
        but you should first test with simple plain HTML.

        BTW, "wiggy.jpg" is a relative path: it will only load the file from
        your computer until you fetch it through a web server.



        --
        -- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
        -- Mi sitio sobre programación web: http://bits.demogracia.com
        -- Mi web de humor al baño María: http://www.demogracia.com
        --

        Comment

        • Martin Honnen

          #5
          Re: Problem with loading image in FF-Win

          Tim Streater wrote:
          Clutching at straws I requested colleagues to try it - and for them,
          with FF under XP, it works. So it looks like it's limited to my PC, but
          I'm damned if I can see why.
          The is a preference dom.disable_ima ge_src_set which is probably true for
          your Firefox profile. Type
          about:config
          into the location bar and search for that preference.

          --

          Martin Honnen

          Comment

          • Tim Streater

            #6
            Re: Problem with loading image in FF-Win

            In article <g142qg$skm$1@h uron.algomas.or g>,
            "Álvaro G. Vicario" <alvaroNOSPAMTH ANKS@demogracia .comwrote:
            Tim Streater escribió:
            The statement:

            myImage.src = "wiggy.jpg" ;

            appears to be a no-operation in FireFox 2.0.0.14 under XP. Works fine in
            IE7 (XP) and on the Mac under Safari and FF.

            myImage points to an <img ...and wiggy.jpg is in the same directory as
            the HTML file (a network mount, from which all these browsers were
            accessing it).

            I did read somewhere that JS is not supposed to have access to the local
            filesystem and therefore the operation should be disallowed anyway,
            however, this sort of operation seems to be widespread. See, e.g.:

            http://www.webdevelopersnotes.com/tips/html/42.php3
            >
            In a previous message you asked advice on how to insert a picture from
            the client file system in a page from an Internet site. This article
            talks about rollovers, which has absolutely nothing to do with it.
            It has a button that says "Hover over me" or words to that effect, and
            the trick they wish to demonstrate (the button changing) did not work on
            my PC. This was an example of my problem. Sorry - I should have made
            that clearer.
            Firefox does allow to dynamically change the src attribute of an <img>
            tag. But it won't display a client image in a server document, not even
            statically:
            >
            <img src="file:///C:/Foo/tmp/paisaje01.jpg" width="100" height="100"
            alt="" title="">
            >
            This works locally but not once you publish the page. If plain HTML
            won't allow it, there's no point in generating that HTML with JavaScript.
            Of course, but at the moment I am researching what technique to be used
            in a larger app, which already exists. I can use an <input type=fileto
            ask a filename, and If I could just have a Submit button then the form's
            action can process the image, no problem. But in this particular
            example, I can't use a submit button, for reasons to do with the
            pre-existing app.

            The image will be added to a database record. In essence I am going to
            have to get the it from the user's file system, hold it in a JS variable
            while the user possibly makes many other changes, on other pages, and
            then when the user wants to save all their changes, store it back in the
            database record, which is on the server. The app, which I wrote, already
            exists - I am just extending it slightly so the user can have a picture
            in the record.
            I'm not sure if you can circumvent it with iframes or any other trick,
            but you should first test with simple plain HTML.
            An iframe is what I am going to have to try.
            BTW, "wiggy.jpg" is a relative path: it will only load the file from
            your computer until you fetch it through a web server.
            Yes - this was just an example.

            Now I know that this issue seems to be limited to my own PC, I'll stop
            trying to fix it (re-installing FF did not help).

            Thanks for your feedback.

            Comment

            • Tim Streater

              #7
              Re: Problem with loading image in FF-Win

              In article <48359376$0$651 8$9b4e6d93@news spool4.arcor-online.net>,
              Martin Honnen <mahotrash@yaho o.dewrote:
              Tim Streater wrote:
              >
              Clutching at straws I requested colleagues to try it - and for them,
              with FF under XP, it works. So it looks like it's limited to my PC, but
              I'm damned if I can see why.
              >
              The is a preference dom.disable_ima ge_src_set which is probably true for
              your Firefox profile. Type
              about:config
              into the location bar and search for that preference.
              Thanks - that's really helpful. I'll look at that tomorrow at work.

              Comment

              Working...