Archive for August 10th, 2007

PNG fix for MSIE now “Rails compatible” (howto)

Friday, August 10th, 2007

PNG transparency doesn’t work in Internet Explorer 5.5 and 6.0. Fortunately there is a fix from Twin Helix, which essentially a little piece of java script that makes PNGs work on MSIE version 5.5 and 6.0.There used to be a problem with the Rails image_tag because it adds parameters to the URL and the fix-script didn’t handle that. But this has now been fixed in version 1.0 RC5 preview 2.

Here’s a guide on how to make it work in Ruby on Rails.

1) Download the IEPNGFix v1.0 RC5 Preview 2 (iepngfix.zip) file from http://www.twinhelix.com/test/ and extract.
2) Create a directory called “iepngfix” in your rails /public/images directory and place the file blank.gif there
3) Place iepngfix.htc in the /public/javascripts/ directory
4) Add this line to your CSS:

5) Open the /javascripts/iepngfix.htc file and change the line that says

(line 15) to:

That’s it.

Troubleshooting: Make sure that the height and width parameters are not missing from your IMG tags.