6

I'm developing a site which is stored locally, and works great in all browsers I've tested except for any versions of IE. It gives me "SCRIPT1014: Invalid character" for each js-file which I've included in script-tags like this for instance: <script src="Scripts/jquery-1.9.1.min.js"></script>

This generates the following error:

SCRIPT1014: Invalid character 
jquery-1.9.1.min.js, line 1 character 1

If I then click the error to view the file in ie developer tools it looks like this:

?? I?%&/m?{J?J??t??`$ؐ@??????iG#)?*??eVe]f@?흼??{???{???;?N'????\fdl??J?ɞ!????~|?"????

etc

I'd except this to be a common problem (Or don't people ever view locally stored webpages in ie?) but I didn't find much when searching, and what I found didn't help.
How to get around this this?

5
  • 1
    I would try to re-download the file and replace the original and see if it helps. Commented Feb 12, 2013 at 14:00
  • What does the jquery-1.9.1.min.js file look like if you view it in, say, Notepad? Commented Feb 12, 2013 at 14:03
  • I would guess it's a character encoding issue. Commented Feb 12, 2013 at 14:05
  • It looks correctly. And this happens with each and every js file I use, ones I've created myself and ones I've downloaded. And I forgot saying that it works if I change to src to "code.jquery.com/jquery-latest.min.js" or such Commented Feb 12, 2013 at 14:06
  • I'd guess it's a character encoding isse too. I did try adding charset="utf-8" to the script-tag but it didn't fix the issue Commented Feb 12, 2013 at 14:09

1 Answer 1

6

There is a similar problem here: SCRIPT1014: Invalid character

I would check the browser security settings for local scripts.

You can try adding this to your page and see if it works:

<!-- saved from url=(0016)http://localhost -->

or you can set the 'local intranet' zone to low and disable protected mode if on.

http://msdn.microsoft.com/en-us/library/ms537628(v=vs.85).aspx

Edit: Answer in comments - cleared browser cache.

Sign up to request clarification or add additional context in comments.

7 Comments

Thanks for the answer. I've already tried both of those. Sorry, guess I could have listed what things I've already tried
Have you cleared your cache? Shot in the dark... Also you can try adding the type for the script <script src="Scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
My god, that actually did the trick. Haha. Thanks! That didn't even occur to me since I hadn't ever opened it in IE before, actually hadn't even opened IE at all since last OS-reinstallation.
Which part? I'll update my answer to reflect it. Also, by charset they mean putting this in the head of the HTML page not the script page: <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Sorry. I skeptically cleared cache like you suggested, then refreshed and it instantly fixed it. Did not try putting that tag in the head, only script tag. I'll try that and come back if I ever run into this again.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.