Trying to do a brain-dump of things I’ve encountered at my new job, since I’ve been doing work in several new areas.
My employer’s website was crashing on IE7. When I tried to re-create the issue on my IE8 machine, it crashed for me as well. Also crashed when I put IE8 in IE7 mode (the Developer Tools are quite nice).
Took me a while to get used to the IE Developer Tools, and eventually I found the JavaScript debugger. Problem was, I couldn’t figure out how to debug a site that crashes the browser once it loads. I thought maybe I could load the page and start the debugger before it crashed. But that didn’t work because what I really needed to do was start the debugger and also tell it to break immediately. If I remember correctly, it defaults to breaking on errors. You have to de-select that button and then click the one next to it so it breaks immediately. Needless to say I didn’t have enough time to do both.
After some fighting and many browser restarts, I did the following:
- Set my home page to about:blank
- Start the debugger on the homepage with the options to break immediately
- Go to the URL that I need to debug
Simple, right? It took me a while to consider that the debugger would actually stay ON as I traveled away from about:blank to a new URL, rather than turning itself off.
Now that I was able to step through the JavaScript, I traced the issue to a link tag that was programmatic-ally being inserted into the head tag. The empty link tag was being inserted using jQuery just fine, but when the href attribute was set to the correct stylesheet URL, the browser would crash (IE8 in IE7 and IE8 mode). The workaround is simple: insert a fully complete link tag at once … don’t modify the href attribute.