Fun Infused Games  |   Smooth Operator RSS 

  Home   |    Archive   |    Subscribe   |    Search   |    About
Posts prior to 8/2/2010 may be missing data. If you need one of those posts, please contact kriswd40@yahoo.com and I will try and recover/find it.

Debugging JavaScript In Internet Explorer Is Terrible
Date 6/10/2008    Tags Development    (0)

One of the most frustrating aspects of creating web applications these days has become JavaScript debugging. Gone are the days of plan old form fields to fill out, users these days need client-side validation, modal-popup windows, calendar objects, and animations that "look cool".

While the AJAX control toolkit will give you a lot of this functionality, you need to get your hands dirty with JavaScript to do anything above and beyond what they offer. On one of my current projects, we've got JavaScript validation, JavaScript functions to open modal-popups, and I believe there is a JavaScript function that calculates the user's favorite color based on which items they hover the mouse over longest and which they avoid (okay, not really that last one).

With all of this reliance on JavaScript, it baffles me that Internet Explorer can be so terrible at debugging it (I run IE 7). First of all, it's hard to use IE to find even where the JavaScript errors are. When you view the details of an error, it gives you a line and character number. More often than not, I find both of these to be zero (completely unhelpful). Sometimes you get a legit line number, and if you're really lucky it matches either a line in your code or a line in the source of the page (though don't count on it).

The error messages IE gives out for JavaScript are equally vague. You might see something like "Expected ;", which tends to mean there is a syntax error somewhere in your code, but the way JavaScript gets parsed, it is in all likelihood far before the line IE says the error occurred on. That seems to be a pretty common occurrence with JavaScript errors.

What really got me writing this rant is I've been struggling with a JavaScript function for passing data between a parent and child window. For some reason, when I call "window.close();" in the child window, it closes that child window and opens a new one. IE didn't see any errors, just exhibited this odd behavior. After smashing my head on the desk several dozen times and being treated for the subsequent concussion, I opened up FireFox which promptly told me exactly where the error was occurring (in a completely different validation function strangely enough). It's crazy that a newcomer like FireFox can so outshine the long established Internet Explorer in this area.

Which brings me to another point... if you want to debug JavaScript (or issues with the DOM for that matter), use FireFox and the Firebug plug-in. Not only is the error reporting better, but you can actually step through JavaScript functions and see what's going on. I think I read that Visual Studio 2008 has some built in JavaScript debugging, which would be great if it's true (assuming it's better than what IE offers), but it will still be a few months before I can make the leap to 2008. Until then, I'm just going to complain.


This article has been view 964 times.


Comments

No comments for this article.


Add Comments

Name *
Website
  Name the animal in the picture below:

*  
Comment *
Insert Cancel


Tags
ASP.net (18)  Fin (1)  Video Games (7)  Game Dev (11)  Abduction Action (1)  WP7 (8)  Visual Studio (1)  Hypership (28)  Advise (14)  C# (14)  FIN (20)  World of Chalk (2)  Absurd (2)  Abduction Action! (27)  Nasty (34)  PC (1)  Cool (2)  Sports (11)  Rant (50)  VolChaos (1)  Development (13)  Design (2)  Volchaos (11)  XNA (40)  Nastier (4)  Xbox (1)  iOS (3)  SQL (1)  XBLIG (32)  Trivia or Die (3)  Web (19)  Trivia Or Die (1)  Abdction Action! (1)