Search code examples
internet-explorer-8internet-explorer-7compatibility

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.


Solution

  • 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.