开发者

IE8 won't load JavaScript file in "Compatibility View."

Here's my JS insert:

<script type="text/javascript" src="include/profile.js"></script>

In IE8 with "Compatibility View," the file never loads. The first line in the file is a simple alert() call, so that I know it loaded. Change the browser to Standards View, and it loads fine.

Also, if I add:

<meta http-equiv="X-UA-Compatible" content="IE=100" >

It forces to Standards View and it loads fine.

Any idea why this would be the case? I've not been able to test against IE7, but I know the JS file 开发者_如何学运维also does not load in IE6.

Right now the tag is in the section of the file.


It would seem that IE8, Safari, Firefox, et al will tolerate certain JavaScript syntax errors. IE7 and IE6 (and IE8 in 'compatibility view') will not, and they will also not throw a parse error or any other kind of clue.

Pasting my code into http://www.jslint.com/ revealed a couple of syntax errors that weren't affecting the code's operation in other browsers. So boo on me.


Okay. Had the same problem on IE8 and safari 5 on windows and finally got this working. This one is really beauty...

I had a function with a parameter named 'class' which was causing the issue. Renaming to clsname fixed the problem. Apparently FF and chrome were lenient about this.


Turn on script debugging and see if you are getting a javascript error in compatibility mode. The presence of an error would keep the javascript from executing even if it is loaded. You might also want to use the developer tools in IE8 to debug the javascript and/or verify if the file is loaded or not.


just spent couple of hours on this - IE7 & 8 suffers from "return" identificator I had:

m["return"] = 123;
var x = m.return; // SILENT ERROR!

Obviously, renamaing identificator solves this

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜