Display transparent PNG in IE 5.5 and IE 6
Display transparent PNG in IE 5.5 and IE 6
PNG transparencies are supported by Firefox, Opera, Konqueror, Safari, Camino, except Internet Explorer 5.5 and 6!
(Internet Explorer 7, supports transparent PNG correctly).
It is therefore particularly difficult, since it requires you:
- not to use PNG transparencies.
- to manage 2 versions of web pages.
Solution
Here is a piece of Javascript (2 kb), which allows IE 5.5 and IE 6 to manage transparent PNG.
http://homepage.ntlworld.com/bobosola/index.htm
The aim is to put this piece of Javascript on your site: pngfis.js
http://homepage.ntlworld.com/bobosola/pngfix.js
then add itto your pages:
<!--[if lt IE 7.]>
<script defer type="text/javascript" src="pngfix.js"></script>
<![endif]-->
Its done!!!!
Note that
It is necessary to indicate the size of transparent PNG (width and height) in each tag <img>.
This does not cause any disturbance in other browsers and will not break W3C validation. Only IE 5.5 and IE 6 will use this piece of code automatically.
- How it works?
- The end of javascript that is executed by IE 5.5 and IE 6. It uses DirectX to load and display PNG.
- Limitations
- There is no solution to the version of IE earlier than 5.5.