Wednesday, March 11, 2009

javascript debugging in ie

Firebug rocks, and though there is a version for IE, it isn't the same. So in developing javascript heavy websites, it is always useful to have an IE brower around and debugging tools so you can figure out why your code is breaking in IE and not Firefox.

There are 3 ways to debug javascript in ie:
1. microsoft script debugger
2. visual studio .net
3. microsoft script editor (comes with office xp/2003)

Seeing as [2] and [3] both involve handing money over to micro$oft. We are left with [1]. The microsoft script debugger is no way related to the Internet Explorer Developer Toolbar

The Script Debugger is pretty sad but at least you can visually see what line of code your IE breaks on. It can still leave you scratching your head as to 'why' though. To enable it go to your "internet options" menu and hit uncheck the "Disable Script Debugging (Internet Explorer)" option.

Note to self: This breaks in IE7
var a = { width: 100, height :200 , };
While invalid syntax, IE7 should not be so delicate it gets tripped up by this. Allowing an extra comma in an array or dynamic object allows for cleaner code when generating javascript from another language.

debug ie6

No comments: