Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Mar 2009
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Need help with displaying image depending on browser

    Does anyone here know of the javascript I'd use in a situation where I didn't want to display a certain image when the client is using IE6? I'm fine with displaying it in IE7 and Firefox, but don't want it displayed in IE6. Any help would be much appreciated. The image is a PNG with a transparent background. thanks!!

  • #2
    Regular Coder
    Join Date
    Dec 2008
    Location
    Tannhäuser Gate
    Posts
    286
    Thanks
    7
    Thanked 58 Times in 57 Posts
    You can use IE conditional comments:
    Code:
    <!--[if !lte IE 6]>  <your img tag>  <![endif]-->

  • #3
    New Coder
    Join Date
    Mar 2009
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I used that code and now I can't see it in Firefox but I can see it in IE7. I haven't tested it in IE6 yet but I need it show up in Firefox as well as IE7. Thanks

  • #4
    Regular Coder
    Join Date
    Dec 2008
    Location
    Tannhäuser Gate
    Posts
    286
    Thanks
    7
    Thanked 58 Times in 57 Posts
    Code:
    <!--[if !lte IE 6]><!-->  your IMG here  <!--<![endif]-->

  • Users who have thanked freedom_razor for this post:

    shaitiger (03-12-2009)

  • #5
    New Coder
    Join Date
    Mar 2009
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks for that. It worked. What about if I wanted to replace the image with another one for IE6? Thanks!!

  • #6
    Regular Coder
    Join Date
    Dec 2008
    Location
    Tannhäuser Gate
    Posts
    286
    Thanks
    7
    Thanked 58 Times in 57 Posts
    That should show the image only in IE6 and lower:
    Code:
    <!--[if lte IE 6]>  <your img tag>  <![endif]-->


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •