JavaScript Code

JavaScript: Fix PNG Transparency in IE without .htc file

The current versions of Internet Explorer do not support PNG transparency. So your nice logo with the faded shadow or invisible background will appear properly in Firefox and Opera, but will have a grey/gray background in IE. Here's how to fix that with one quick script.

This script is adapted from the popular PNG fix, which uses the CSS behavior attribute, and a .htc file. I don't like that method; it's bulky, requires an additional file, and behavior is not even valid CSS. So here's a function that does all the same in just a few lines.

function fixPNG()
{
for(var i=0; i

Share

1 Comments

  1. this really is an simpliest version of em' all. really helped me 🙂 BIG thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image