Debugging JavaScript in Internet Explorer
I am working on a relatively complex JavaScript-driven website. It runs great in all browsers except Internet Explorer (7, this particular version is our corporate standard). I am getting this very curious error:
"A Runtime Error has occurred. Do you wish to Debug? Line: 93,865,600. Error: Expected ';'"
The issue is, I don't have 93 million lines of code, and clicking "Yes" doesn't attach to Visual Studio like it normally does.
I can click on 'No' and the website continues to run fine, but if a user doesn't have JavaScript debugging disabled, I don't want them to see this meaningless error开发者_JAVA技巧.
Suggestions/Tools/Plugins to get to the bottom of this?
And yeah, I learned my lesson, switch over and check my project in Internet Explorer more often...
Thanks,
It's not strictly a debugging tool, but I wouldn't be surprised if Ajax DynaTrace helped you track down the weirdness.
http://ajax.dynatrace.com/pages/learn/solution-tour/ajax-performance-diagnostics.aspx
Also, run your code through JSLint. The error message makes it sound like you have a subtle syntax error that some browsers tolerate.
Here are a couple of debugging tools I use on IE.
- IE Developer Toolbar
- Firebug Lite
- MS Script Debugger
AND within IE, get it to scream about every other error that it encounters under Options. Here are the instructions to do so, you can also read the very useful debugging tips in the presented in the slideshow.
This will give a better picture where the error is occurring. If that doesn't work, you might want to try breaking down your scripts by not including parts of it, to see which parts or which particular JS script file is giving you problems.
This is still my best Javascript debugger on IE so far: Microsoft Web Developer Express
still much better than Developer Toolbar in IE8.
Totti
I would also use Fiddler2 to view the exact files that are being given to the browser. There may be code on the server that adjusts the files before they are sent. Using Fiddler, you can see what the browser is receiving.
Also make sure you are using IE8, as the Developer Toolbar is built in to it. If not IE8, download the IE Developer Toolbar, as 'bron' said.
精彩评论