开发者

Fixing JS errors in IE

开发者 https://www.devze.com 2022-12-14 10:23 出处:网络
I\'m using jQuery for my app and I\'m getting this error in IE: Line: 13 Char: 9 Error: Expected Identifier, string or number

I'm using jQuery for my app and I'm getting this error in IE:

Line: 13
Char: 9
Error: Expected Identifier, string or number
Code: 0

..well, as you can see, the error isn't quite helpful. How do you fix those weird IE errors? Is there a开发者_开发技巧ny tool or a list of error descriptions that tells you what to fix?

Thanks


I would suggest looking at line 13 of your JS file to find out where the error is.

FWIW, the "Expected Identifier, string or number" error often occurs when you have a trailing comma in a list or object declaration. Firefox doesn't mind this, but IE does.


Here's an article on debugging javascript in IE. IE8 comes with a built-in debugger.


The IE Script debugger is quite OK.

But try Mozilla's error console first. It has sane line numbering. Maybe the errors are identical.


  • Make sure you have Microsoft Office installed

  • In IE, go to Tools -> Internet Options -> Advanced tab

  • From there UNCHECK "Disable script debugging (Internet Explorer)"

  • Then when a script creates an error, you will be presented with a dialog box:

Fixing JS errors in IE

Click the YES button to sign your life over to microsoft to start the debugger.

This is a really tedious workflow (the default sound that happens when a script bug is encountered is really annoying) so I don't think its a good way to work, recommend firefox error console over it any day.

See also.

0

精彩评论

暂无评论...
验证码 换一张
取 消