IE crash on just plain HTML
I've experienced a very weird crash on Windows Internet Explorer (XP SP2, English) just yesterday. So here's the problem and the solution and may be, just may be it will help somebody.. someday.
The problem is that IE was crashing on me completely. And according to reports I was getting, mshtml.dll was the problem - so it is definitely IE's HTML renderer (thanks Remedee for pointing this out as I suck as Windows debugging - 100% Mac user).
And the code I was having on the page was just an ordinary blocked output (photo + description, in a SPAN tag), just as follows:
<span class="item"><a xhref="girls.html?id=<?=$stuff[id]?>" onclick="girlinfo(<?=$stuff[id]?>); return false">
<?php article_printImageTag($stuff[id], 120, 120, "top_1", 1) ?>
</a>
<?php echo $stuff[title] ?>
</span>
The result was a grid of pictures with descriptions under them.
The problem was that if I had over 23 such blocks on a page, IE was just crashing on me!! With some weird "illegal access" 0xC0000005 in mshtml.dll (or something) error. And of course ALL OTHER browsers (Firefox, Safari, Opera) were processing the page without any noticable problems at all.
Well I dunno.. was thinking about inline javascript was causing the problems. And inline javascript is NOT a good thing, but of course it depends.. for example if you have LOADs of images and want to create something like lightbox gallery that would work without needing to wait for the whole page to load (and it WILL take time for lots of images). Anyways.. I was using inline Javascript and though it was causing the problem, so got rid of it, but it didn't help at all. Then.. I just started to remove blocks of code and the problem seem to disappear, but I was left with a non-functional page (I need it to look exactly the way I want, and anyway, that's not a huge amount of markup to be able to play with many combinations).
In the end, the solution for the problem was to add the <span> tag around the text below the picture. JUST TWO TAGS solved the problem.
The resulting code was just like the one below:
<span class="item"><a xhref="girls.html?id=<?=$stuff[id]?>" onclick="girlinfo(<?=$stuff[id]?>); return false">
<?php article_printImageTag($stuff[id], 120, 120, "top_1", 1) ?>
</a>
<span>
<?php echo $stuff[title] ?>
</span>
</span>
Now.. I don't know what was the source of the problem for IE. It could be that I just suck at coding and and don't know the basics. And I definitely will remember about the problem and solution in the future.. But can anyone explain my.. WHY?.. Well it was rhethoric question I guess :)
PS: Oh and yes, the page actually validates..
July 25th, 2006 at 6:12 pm
You know there's two cruical thing missing about your bug report.
* The complete *rendered* html (preferably reduced to the tiniest nonsensical form that still crashes for you)
July 25th, 2006 at 6:15 pm
Ouch. I've been having fun with classic IE/Mozilla CSS compatability problems myself.
I think I can guess what project you were working on, seeing as it's "girls.html" ;)
July 25th, 2006 at 6:53 pm
I think it doesn't make much sense to include the whole rendered page here. But it worth mention that the page actually validates against HTML 4.01 Transitional which it states in the header. Actually, both crashing and non-crashing versions validate. So it definitely is a problem with IE. Although of course even completely correctly coded page still isn't guaranteed to work in IE :) That why we all like this browser, right? ;) I mean.. lots of exciting moments just before the project deadline
July 25th, 2006 at 6:55 pm
Ben, yeah it is that site ;) Today's the deadline and the problem appeared just yesterday at about 22:00 (some new content was added). Man I hate these late-minute bugs. AND THE BLOODY PAGE VALIDATES! (i mean.. except for ALTs that is ;)
July 25th, 2006 at 7:49 pm
Well yeah, "It doesn't make sense to include the whole html here…"
Well yeah I tried what you did in plain html and IE didn't crash for me, I guess you've got either absolutely no clue of HTML or you've got an extremely fucked up IE, or both.
Move on, just a smacktard jumping for hits. Bugreports happen elsewhere.
July 25th, 2006 at 7:53 pm
Including a demonstratable and repeatable flaw is something usefull. We could look out for it, avoid it's usage and M$ could do something about it (unlikely, I know).
All hail random ranting!
July 25th, 2006 at 8:47 pm
Florian, first you should keep your tone down and learn to be grown up (or pretend to be).
The page validates as valid HTML, and I have my reasons not to post the whole code here. You have idea how to post "a page" which consists of html, css, and accomaning javascript, with html code being not the biggest part of it? Or you want just HTML and think you will be able to identify the source of the problem by looking at 1/3 of the whole picture? Oh well.. I guess Javascript doesn't have anything to do with the problem so it will be 50% of the code..
Anyway, as I said, HTML is valid, and the point is that if you or somebody else will have similar problems, they can may be remember this blog and fix the problem spending less time and nerve cells than it would take without reading this blog post.
As for hits… well I have to admit that it's nice to have lots of hits and being helpful to somebody (hopefully). But I have no real reason to "jump" for them. Any google ads on this site or any hidden counters? I guess you won't find any because there are not.
So now, thanks for comments and I do hope you did have learned something from this blog entry. And feel free to bury me on digg anytime, brother :)
August 20th, 2006 at 8:32 am
What is the xref attribute in the anchor? I think you meant href, no?
I even looked up my trusty html spec to make sure I wasn't smoking something, and afaict, there is no xref.
August 21st, 2006 at 9:57 am
Dave,
yes, it is supposed to be good old href, but it looks like wordpress likes to play with html tags in posts :/ So yes, xhref ius actually href.