View Full Version : Need help with displaying image depending on browser

03-12-2009, 02:29 PM
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!!

03-12-2009, 02:41 PM
You can use IE conditional comments:

<!--[if !lte IE 6]> <your img tag> <![endif]-->

03-12-2009, 02:52 PM
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

03-12-2009, 03:06 PM
<!--[if !lte IE 6]><!--> your IMG here <!--<![endif]-->

03-12-2009, 06:54 PM
Thanks for that. It worked. What about if I wanted to replace the image with another one for IE6? Thanks!!

03-12-2009, 07:08 PM
That should show the image only in IE6 and lower:

<!--[if lte IE 6]> <your img tag> <![endif]-->