I have a development site which seems to have an intermittent Javascript error in IE7. Now I can fully test IE7, but I was wondering if there is a resource that would allow me to analyze the Javascript for possible browser issues.
4 Answers
A common IE-only problem is the inclusion of closing commas in array or object literals. Non-IE browsers handle this fine.
Are you generating any array or object literals via a JSON response or similar?
Eg
a = [1,2,4,]; // error in IE, not in other browsers
b = {a: 1, b: 2,}; // also error in IE
1 Comment
Stefan Kendall
This is especially terrible if it's part of inline JS in an AJAX'd JSP, as IE gives no indication as to the actual line number of the problem.
Look for any code that runs as the page loads.
ex:
<script src = "test.js"></script>
test.js
document.getElementById("whatever");
Depending on the speed of the JS interpreter, you'll get a race condition with the loading of the script vs. the loading of the DOM. If the issue is "intermittent", this is almost certainly the problem. Stick everything that looks at the DOM in $(document).ready
1 Comment
Larry K
Yes, I've had this problem with IE too. The IE interpreter is so amazingly slow compared to other browsers, you can run into race conditions you don't see elsewhere.