Brilla.org

Tag: cancerous software

An IE6 bug dissected: iFrames, IE7.js, and more dumb things Microsoft

by Jon on Jan.20, 2010, under Web, Work

We don’t do markup or CSS. We take the code you give us and chop it up with some XSLT, so that it wraps on top of our XML-based content management system beautifully. (If you are still tuning in then you’re definitely a web developer on the hunt for a bug fix… keep reading)

There’s the IE6 problem. It renders everything that should be beautiful to look like absolute ass. Thankfully, that ain’t our problem.

But, for times when it is your problem, someone smarter than me came up with a brilliant solution to this. IE7.js a workaround to get IE6 to play nicely like it should. Just drop it in and it does the rest. Done and done.

Recently a client delivered some XHTML/CSS making use of IE7.js. Done and done; set it and forget it.

So we did. Nobody actually checked out their finished site in IE6 — frankly, because no one with a right mind actually uses that browser.

But, the client’s clients do. They started getting emails that everything was ugly in that awful broken old excuse for a browser.

Henceforth, the IE6 problem became my problem.

So what changed? Assuming we kept all that intact in the process (we did), why then, would a demo page with bogus content look fine, but once it’s filled out with living, breathing pages and news stories, does everything blow up?

JavaScript error. Hm:  ‘v’ is null or not an object.

v is null or not an object

A little Googling reveals a possible culprit. Apparently, IE7.js starts acting up when frames are involved. Our CMS solution does make unabashed use of iframes.

So, I make the code changes mentioned in that message. Save, dump cache, and hit F5. A new error message appears:

Internet Explorer cannot open the Internet site http://…

Operation aborted.

Internet Explorer cannot open the Internet site ... / Operation aborted

Seriously? After that, my web page defaults to a yucky The page cannot be displayed screen. Ick.

More Googling and I find myself skeptically glossing over a page on MSDN. And there she is:

2. Adding the defer boolean attribute to the script block (this defers execution of the script content until parsing is complete)

I’d heard of this ‘defer’ thing before. It’s a stupid IE-only attribute that instructs the browser to not load the script until the page is done rendering. Think of it as one big $(document).ready().

So I add ” defer” to my opening <script> tag. Error messages gone. Blank screens gone. Page is no longer looking yucko in IE6, it renders like it should. Everything just works™.

In conclusion (TL, DR)

If your IE7.js is acting a fool on you, put defer to work:

<!--[if lt IE 7]>
<script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE7.js" type="text/javascript" defer="defer"></script>
<![endif]-->

Set it, and forget it.

Comments Off :, , , , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...