Viewing Javascript Generated Source in IE

After having battled IE for the past two days, I am glad to report that I actually learned something new and valuable when debugging for Javascript codes in IE. One of the chief complaints web developers have towards IE is its lack of a decent Javascript debugger. Hell, none of IE’s SEVEN versions even have a usable Javascript error console! After having written about my frustration finding a debugger, another useful thing a web developer would love to see is the actual HTML source code generated by all that wonderful Ajax/DOM scripting… Thankfully, there is a way.

It’s documented here by Eric Appel. Basically, I just need to type in a one-liner Javascript in IE’s URL to show the source.

javascript:'<xmp>' + window.document.body.outerHTML+ '</xmp>'

In case you didn’t already know, viewing generated source is quite simple in FIrefox via an addon appropriately called Web Developer. In Safari 3, the closest thing is to right click and select “Inspect Element” from the contextual menu.

I am still stunned at how far IE has fallen behind in feature set for both users and developers in its seventh iteration of the software (having zero development effort since it drove Netscape into ground). But I am still thankful for conditional comments the IE team has decided to support. At least it’s made life with IE using CSS a much more straight forward task.