I have a webpage that I recently changed that works great on all browsers except for IE7. On IE7 I see the following:
SCRIPT1014: Invalid character blah.html, line 1 character 1
Screenshot:

I’ve reviewed the code several times and nothing sticks out. I know its a javascript error, but I can’t pinpoint where.
The frustrating part is not knowing where to look (line 1 character 1) and the error being vague.
Error in a Nutshell
The problem was a javascript error inside a string in a call to
window.setTimeout.More Detail
The string in
window.setTimeout([string], [int])is executed as an eval, so it caused a javascript error during execution, which for me happened to be during the window onload event.Why did the error say “Invalid Character”?
Because I used a
#instead of a$to start a jquery command. The javascript compiler didn’t know what to do with#so it threw an error.Why did the error report being on line 1 character 1?
Since the string in the
window.setTimeoutis executed as an eval, the error was reported on line 1 character 1 – which finally makes sense!Sample html to replicate issue
Here is a sample page I created demonstrating the issue:
Resolution
I accidentally used a
#instead of a$for a jquery command in the eval string. This is actually legacy code, so I refactored it to call a specific function rather than invoke an eval on a string (evil) so it now looks more like:Note that with this change that finding the original error would’ve been much easier as it would’ve given a specific line and character number relative to the page rather than the eval string.