javascript 获取 SCRIPT1014:来自本地 js 文件的 IE 中的无效字符

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14834261/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 22:42:29  来源:igfitidea点击:

Getting SCRIPT1014: Invalid character in IE from local js file

javascriptinternet-explorerlocal

提问by Clox

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>

我正在开发一个存储在本地的站点,并且在我测试过的所有浏览器中都运行良好,除了 IE 的任何版本。它为我包含在脚本标签中的每个 js 文件提供了“SCRIPT1014:无效字符”,例如:<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:

如果我然后单击错误以在 ie 开发人员工具中查看文件,它看起来像这样:

?? 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?

我希望这是一个常见问题(或者人们从来没有在 ie 中查看本地存储的网页?)但我在搜索时没有找到太多,而且我发现的内容没有帮助。
如何解决这个问题?

采纳答案by Zach

There is a similar problem here: SCRIPT1014: Invalid character

这里有一个类似的问题: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.

或者您可以将“本地 Intranet”区域设置为低并禁用保护模式(如果打开)。

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

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

Edit: Answer in comments - cleared browser cache.

编辑:在评论中回答 - 清除浏览器缓存。