Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

PNG for every browser EXCEPT MSIE

Posted on 2006-07-09
3
Medium Priority
?
198 Views
Last Modified: 2008-03-17
Hello.

I have two versions of the image 'balloon.png'.

The .PNG looks better but it does not work properly on MSIE because it has an alpha-transparency.

So I want to serve the UGLY .GIF to MSIE users but the .PNG to everyone else.

Right now I use this to display the PNG version:
                    document.writeln("<img src='balloon.png' onmouseover='fix(\""+j+"\");'>");


I need something like this, but my syntax is off...

                    if (browser==MSIE) imgExt=".gif" else imgExt=".png"
                    document.writeln("<img src='balloon."+imgExt+"' onmouseover='fix(\""+j+"\");'>");


Any ideas  how?

Thanks!

0
Comment
Question by:hankknight
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
sam85281 earned 2000 total points
ID: 17068944
if (navigator.appName == 'Microsoft Internet Explorer') {
// do this
} else {
//do this
}

-Sam
0
 
LVL 16

Expert Comment

by:sam85281
ID: 17068956
By the way, you CAN use a PNG in IE with a little simple scripting.

This tells all:

http://homepage.ntlworld.com/bobosola/

-Sam
0
 
LVL 16

Author Comment

by:hankknight
ID: 17069238
Thanks!

I accepted you first comment as the answer because it directly answers my question, but I will be using the IE PNG fix as a solution.
0

Featured Post

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question