Browser enable image

Discussion in 'Javascript' started by sarmad.alsaiegh@googlemail.com, Sep 7, 2008.

  1. Guest

    hi all,
    i need ur help pls.
    how can i detect the client browser setting with javascript. example:
    the client browser blocked Popups. this example i could solve it, but
    what i need is right now, how can i know if the browser of the client
    are enable images to display.

    if u dont understand my question, pls tell me and i will describe it
    again.
    thanks and i hope for answer.

    best wishes,
    sarmad
    , Sep 7, 2008
    #1
    1. Advertising

  2. SAM Guest

    a écrit :
    > how can i know if the browser of the client
    > are enable images to display.


    I don't know.
    Why that for ? (what about accessibility ?)

    <html>
    <script type="text/javascript">
    var imags = false;
    window.onload = function() {
    alert('images accepted ? '+imags);
    }
    </script>
    <img src="image_test.gif" alt="text images" onload="imags=true;">
    </html>


    Seems to work in my Fx,
    (even with images blocker (Estension: Web Developer) --> false)
    and also : Safari, Opera and IE.6-standalone


    --
    sm
    SAM, Sep 7, 2008
    #2
    1. Advertising

  3. Steve Swift Guest

    wrote:
    > how can i know if the browser of the client are enable images to
    > display.


    The only mechanism I can think of is to run some JavaScript at the
    beginning of the page load (inline, near the start of the HTML) that
    stores the time, and then again in the onLoad event where it subtracts
    the load time from the current time. Include an image which is huge,
    but preferrably invisible.

    If the page takes a long time to load, then presumably the browser
    downloaded the image, so has images enabled.

    This approach has so many flaws that I don't have the time to list them.

    --
    Steve Swift
    http://www.swiftys.org.uk/swifty.html
    http://www.ringers.org.uk
    Steve Swift, Sep 8, 2008
    #3
  4. SAM Guest

    Steve Swift a écrit :
    > wrote:
    >> how can i know if the browser of the client are enable images to
    >> display.

    >
    > The only mechanism I can think of is to run some JavaScript at the
    > beginning of the page load (inline, near the start of the HTML) that
    > stores the time, and then again in the onLoad event where it subtracts
    > the load time from the current time. Include an image which is huge,
    > but preferrably invisible.


    I think we have not to wait downloading time since compliant graphical
    browsers wait all images are loaded before to launch the JS 'onload'
    attributed to the body tag.

    > If the page takes a long time to load, then presumably the browser
    > downloaded the image, so has images enabled.


    You can also use an 'onload' in a transparent very small image to toggle
    a variable defined previously in the head.

    > This approach has so many flaws that I don't have the time to list them.


    See my code given in my previous post.

    Tested on my browsers, it seems to work (except in IE Mac which launches
    the body onload before loading images) but I don't know what that could
    give in a text browser ?
    (do text browsers use JS ? if yes, what that can give with dhtml ?)

    --
    sm
    SAM, Sep 8, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Patrick
    Replies:
    1
    Views:
    648
  2. Daisaku
    Replies:
    0
    Views:
    211
    Daisaku
    Nov 20, 2003
  3. Rod

    How to enable Image button from anoter frame

    Rod, Aug 3, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    136
  4. Corinna Vinschen
    Replies:
    1
    Views:
    151
    Corinna Vinschen
    Feb 27, 2007
  5. aidy
    Replies:
    0
    Views:
    99
Loading...

Share This Page