views:

545

answers:

2

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.

A: 

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.

tvanfosson
This has something to do with IE7 mode - because IE7 does the same thing. Not getting any JS errors at all. It "sees" the JS file, and in IE8 I can see the source for the file... but it's like it isn't parsing it for some reason.
Don Jones
A: 

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.

Don Jones
The usual suspect is the trailing comma in list and object literals.
bobince
Absolutely correct. That's what it was. JSLint made it very easy to spot them.
Don Jones