How To Fix Internet Explorer Javascript, PNG Transparency, and Other CSS Problems In One Simple Step

Filed August 31st, 2010 under Web Technologies

We’ve all been there – project is nearing completion, your site looks great in webkit and firefox, and you want to get paid, but your curmudgeonly client cares what his site looks like in IE6 because his clients are all civil servants, and the government only updates their computers once a decade. Or maybe you just run a publishing site like mine, at SalaciousSound.com, and would prefer not to ignore the largest browser segment in the market.

Either way, Internet Explorer can be a pain in the butt, but only if you let it!

I just came across a solution in the google code repository called ie7-js, which

is a JavaScript library to make Microsoft Internet Explorer behave like a standards-compliant browser. It fixes many HTML and CSS issues and makes transparent PNG work correctly under IE5 and IE6.

Pretty sweet. I just tried it out, and it worked like a charm.

Option 1 – If all your png images with transparency end in “-trans.png”

Only one quick step is required, since the people hosting the code are cool with direct linking to the js file (which helps load time a lot, especially in the case of jquery). Copy and paste this code, and you’re good to go:

<!--[if lt IE 8]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE8.js"></script>
<![endif]-->

Option 2 – No consistency in filenaming of png images with transparencyCopy and paste this code, and you’re good to go:

<!--[if lt IE 8]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE8.js">
IE7_PNG_SUFFIX=".png";
</script>
<![endif]-->
Cailen
Cailen lives in Toronto. He is passionate about music and coffee culture, photography and videography, and code efficiency.

2 Responses

§ RandomDude wrote on September, 21st:

Awesome! I always hated having to change everything so that IE could display my sites correctly. Thank you so much for sharing.

§ Tripp wrote on September, 21st:

This isn’t working for me. Using Option 2, I get a JS error with IE6 and that’s about the weight of it.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>