admin管理员组

文章数量:1365845

Hello I am getting this error in IE when i load any js file what should I do? Webpage error details

User Agent: Mozilla/4.0 (patible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET CLR 1.1.4322)
Timestamp: Tue, 1 Mar 2011 18:34:03 UTC


Message: Expected identifier
Line: 26
Char: 21
Code: 0
URI: http://localhost/learning/public/js/general.js


Message: Object expected
Line: 5
Char: 3
Code: 0
URI: http://localhost/learning/public/js/tests.js

Hello I am getting this error in IE when i load any js file what should I do? Webpage error details

User Agent: Mozilla/4.0 (patible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET CLR 1.1.4322)
Timestamp: Tue, 1 Mar 2011 18:34:03 UTC


Message: Expected identifier
Line: 26
Char: 21
Code: 0
URI: http://localhost/learning/public/js/general.js


Message: Object expected
Line: 5
Char: 3
Code: 0
URI: http://localhost/learning/public/js/tests.js
Share Improve this question edited Mar 1, 2011 at 18:48 Wayne 60.4k15 gold badges135 silver badges128 bronze badges asked Mar 1, 2011 at 18:36 aephixusaephixus 1132 gold badges2 silver badges9 bronze badges 3
  • 1 Could you check your addons. Things like a yahoo tool bar. I will disable all addons and then try again. * – billygoat Commented Mar 1, 2011 at 18:40
  • Apparently, there should be an object on line 5, and an identifier on line 26. Without your JS code, we cannot help you. – gen_Eric Commented Mar 1, 2011 at 18:52
  • Question doesn't belong on StackOverflow – Yngve B-Nilsen Commented Aug 1, 2012 at 12:25
Add a ment  | 

2 Answers 2

Reset to default 5

It is likely either as @g.d.d.c says, a problem with a trailing ma, or the error es from using reserved key words. When Explorer sees variable names like super, class and exports it will strip those away before evaluating the code.

class = 'asdf';

… bees …

= 'asdf';

And thus there is no identifier to assign the 'asdf' string to.

I'm willing to wager the cause is an extra ma at the end of an Object Declaration:

var valid = {
  'key': 'Value'
};

var invalid = {
  'key': 'Value',
};

Google Chrome / Firefox and I believe Safari are intelligent enough to ignore the extra ma. Internet Explorer sees the ma and expects another property to be assigned to the Object.

本文标签: javascriptInternet explorer errors 39Expected identifier39 and 39Object expected39Stack Overflow