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

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.

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

  1. Angus Turnbull Says:

    I’m glad you like the script!

    I’d definitely appreciate it if you could link to the main IEPNGFix download page though; the /test/ area is often emptied of scripts as they are released, whcih 1.0RC5 shortly will be.

    I’ve now posted the RC5 download link within the main script page so that shouldn’t cause problems :).

  2. Mario Says:

    Hey! Thanks for that. It was super helpful!

Leave a Reply