Home > Web > !u@#!^$ “Invalid character” IE error

!u@#!^$ “Invalid character” IE error

Internet Explorer is probably the worst browser for web development. Or maybe I’m too used to Firefox.
Let me give you just a simple example, that can drive you mad.
Have you ever encountered the below error?

Line: 2
Char: 1
Error: Invalid character
Code: 0
URL: ... 

I did. So I googled a little bit to see what could be the problem and I come over this article. Of course, that wasn’t the problem. Finally, I realized myself: one of the referenced JavaScript files was missing.

I know that this is my mistake, but I’m totally amazed about the usefulness of the IE error messages. It is a missing file, not an invalid character.
Not to mention, that the URL is always the main one, even though the error occurred in one of the referenced JavaScript files and the line reported is not the actual line where the error occurred, but increased by 1. But this is already common knowledge.

That’s one of the reasons I always use Firefox for web development, try to stick to the standards and only in the end, test the solution on Internet Explorer too. And there is no decent JavaScript debugger for IE. And …

I also wrote a small HTML, for you to see what I’m talking about.

Later update: This was tested on IE6. In IE8 works as expected.

Categories: Web Tags: , ,
  1. JFR
    January 28, 2009 at 10:02 pm


    You can try Companion.JS :


    It is free and gives you detailled info about javascript errors under IE.

    Hope this helps.


  2. January 29, 2009 at 10:36 am

    Actually I tried it, but it’s not by far the same experience as with Venkman in Firefox. And if I throw in the game, Web Developer Toolbar, HttpFox, JSView, User Agent Switcher, then Firefox is totally winning. At least for me.

  3. JFR
    January 29, 2009 at 10:41 am

    Well. I’m not sure to understand. Is it a comparison between firefox and IE ? In this case for usre Firefox wins.

    Or are you trying to find a useful tool to debug under IE specifically ?
    In this case Companion.JS gives detailled information about the js error with possible stack trace, which is much more useful than the standard IE js error box.

  4. January 29, 2009 at 10:55 am

    Neither. I was blogging about my IE frustration and why Firefox is a much better web development environment.

    Indeed, CompanionJS is a useful tool which could help you debug web pages in IE.

  5. Mic
    February 11, 2009 at 2:00 pm

    Your article didn’t really help on my invalid character issue đŸ˜‰

    But, you may have a look at the Visual Web Developer(Express Edition).
    It is a very good and free debugger for IE. You can debug on the local web server provided with VWD or remotely on another server.

    IE8 comes with a good debugger too, but not very useful for older versions.

    I use it with WinXP on VirtualBox.

  6. June 11, 2009 at 7:39 am

    Totally with you. Just having this error pop up when inserting a cd with autorun.exe . Bloody IE. No js files missing either. Real PITA.

  7. Sim
    June 19, 2009 at 4:57 pm

    Thanks so much, you just solved my problem!!!

    And also thanks for the rant about iE, so i don’t have to do it here…

  8. June 19, 2009 at 11:13 pm

    Thanks again. We narrowed it down to one particular js file so far. Still trying to determine what exactly in the js file IE doesn’t like.

    This IE thing is a ‘feature’ they introduced in XP SP2, and affects IE7 as well. Not sure about IE8.

  9. Angel
    March 6, 2010 at 9:35 pm

    Thank you, thank you!
    I was going mad with this error.

  10. SavedMeTonOfTime
    March 19, 2010 at 3:34 pm

    Awesome catch about the missing js file. Thank you.

    June 3, 2010 at 6:37 am

    Nope, you are not wrong


    granted it was IE6 that destroyed Netscape’s crap…

  12. February 10, 2011 at 6:06 am

    Windows 7 solution.

    When I right-clicked -> Properties on the local file I was loading in IE8:
    … there was a new section (i had never seen before) just below the “Attributes (read only / hidden)” section.

    The new section included a new button “Unblock” with text indicating that “this file came from another computer and could potential be unsafe” (or something like that.

    When I clicked the “Unblock” button the local file no longer had the “invalid character, Line 1 Character 0” for the javascript file.

  13. Muneeb
    June 14, 2012 at 12:33 pm


  14. October 28, 2012 at 7:59 am

    It’s a pity you don’t have a donate button! I’d definitely donate to this superb blog! I suppose for now i’ll settle for bookmarking and adding your RSS
    feed to my Google account. I look forward to brand new updates and will talk about this website with my
    Facebook group. Chat soon!

  1. November 19, 2014 at 6:40 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: