David Janes' Code Weblog

November 10, 2008

Syntax Error on Line 1

html / javascript,tips · David Janes · 11:34 am ·

Here’s a nasty little error that I tracked down on IE6 this morning. The error message (click on the icon in the lower left of the browser) is something like Error: Syntax Error; Code 0; Line: 1.

Of course, when you go to look for the error in your Javascript, nothing seems to be wrong.  One explanation I found for this was that a BODY onload tag is broken. In our case however this wasn’t the issue.

Instead it was really something quite simple: we were using a SCRIPT tag to download a Javascript file that no longer existed and was 302 redirecting to an HTML page! The IE6 Javascript engine then attempted to execute the HTML and of course immediately failed. In our case, this happened because we were getting a partner widget and they had changed the URL without notifying us. A 404 error would have been more appropriate, though I have not tested to see whether the same error would then occur.

One further note: if you’re debugging scripts on IE6:


  1. That debugger is mighty annoying. When it’s operational all IE-based apps are frozen (including Outlook). And when a JS error is encountered, a dialog box pops up to break or continue, but both do the same thing — break.

  2. admin · 2008-11-11 15:25

    Hey Dmitri! Hopefully we’re all just using IE6 as a _legacy compatibility_ browser, so the issue doesn’t pop up too often ;-)

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress