Chomper Stomping jQuery/JavaScript/CSS 3/HTML 5, Java/PHP/Python/ActionScript, Git, Chrome/Firefox Extensions, Wordpress/Game/iPhone App Development and other random techie tidbits I've collected

17Dec/070

Debugging Javascript in IE

Trying to debug javascript (or even write a web-page) using IE is enough to bring a grown man weeping for a merciful swift death on his knees. Or at least enough to drive you to take frequent breaks, drink multiple cups of coffee, and play with relaxing meditative toys (like the rubiks cube, or a stress ball, or a jacobs ladder, etc). I'm sure this guy was probably debugging javascript, although it was probably back during the first Netscape/IE browser wars:

I am currently working on one AJAX enabled web page with 500 lines of javascript (and that's using jQuery to exponentially simplify it, and I'm only 1/3 of the way done too). So I finally decided to fire up my beautifully working script in IE after working for a few days in FF.

Done, but with errors on page.

Oh crap. My javascript is all extracted out into included script files (five of them) so all it does is give me the line number on the main page that is calling the file with the error. The file with the error is 150 line of javascript that works perfectly in FF. That's all the information I am given.

When I get an error in firefox, it tells me the exact line number in the exact file that is giving me trouble. I can normally fix the error in about 2 minutes at the most. I spent the last 30 minutes on this one.

The problem was that I had mistakenly named a variable "class" which I'm sure those of you who are still reading at this point know is a reserved word. I simply renamed it "theClass" and moved on. But why did IE fail me so miserably when I failed it, and how can we work together better in the future?

Well, to begin with, the way I finally found the error was to type in the exact URL to the Javascript file that was giving me the error in the first place. It failed to open because of the error, but mercifully told me what line number in that file was giving it the error (took me 3 seconds to realize what was wrong and another 2 to fix it after that).

There had to be another way though, so I went in search of a javascript debugger on Yahoo (ha ha, just kidding, who uses Yahoo anymore? I went to Google). I came upon this blog post which pointed me to this Microsoft page which after giving me a thorough cavity search to make sure I wasn't a theif using a stolen copy of their precious software (which seems to have become as standard as shaking hands for M$) let me download their software.

I install the script debugger (on Vista) and pop open IE.... nothing. It freezes. The browser doesn't even start properly. I have to kill it and try again. Still nothing. I restart. Nothing. I uninstall and redownload THREE TIMES, run a virus scan, uninstall all other addons and toolbars, and two hours later Still NOTHING. #$&! #*&@!# *$ $#!+!!!!!!!!!!

This scene of office space came to mind at this point:

http://www.youtube.com/watch?v=T6syezOHJ2Q

If only someone had stolen Bill Gates original computer and done this to it the weekend he decided to steal BASIC and mod it and start selling it...

Haha. I don't really hate Microsoft that much. I mean, I'm sure I would feel the same way sometimes if I were on a Mac, or using Linux... right? right?

So I still haven't really "solved" my javascript debugging needs. At least I have a crappy work around...

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

No trackbacks yet.