为什么 IE 限制本地 HTML 页面的 JavaScript 文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8146926/
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
Why does IE restrict the JavaScript files of local HTML pages?
提问by subho das
Why does IE restrict JavaScript files from working when we open a local html file? The message says:
当我们打开本地 html 文件时,为什么 IE 会限制 JavaScript 文件的工作?消息说:
"To help protect your security, Internet explorer has restricted this web page from running scripts or ActiveX controls that could access your computer. Click here for the options"
“为了帮助保护您的安全,Internet Explorer 已限制此网页运行可以访问您计算机的脚本或 ActiveX 控件。单击此处查看选项”
Can anyone tell me how get get rid of this?
谁能告诉我如何摆脱这个?
回答by Trent Scholl
Check out http://msdn.microsoft.com/en-us/library/ms537628(v=vs.85).aspx
查看http://msdn.microsoft.com/en-us/library/ms537628(v=vs.85).aspx
If you want to run in the Internet zone add this to your HTML source:
如果您想在 Internet 区域中运行,请将其添加到您的 HTML 源代码中:
<!-- saved from url=(0014)about:internet -->
If you want to run in the Intranet zone add this to your HTML source:
如果您想在 Intranet 区域中运行,请将其添加到您的 HTML 源代码中:
<!-- saved from url=(0016)http://localhost -->
Either will stop the message from displaying and allow JavaScript to execute.
要么将停止显示消息并允许 JavaScript 执行。
This will also allow the file to open on other PC's without having to change Internet Explorer options.
这也将允许文件在其他 PC 上打开,而无需更改 Internet Explorer 选项。
回答by donutdan4114
In IE, go to Internet Options. Then 'Security' tab.
在 IE 中,转到 Internet 选项。然后是“安全”选项卡。
Set the 'local intranet' zone to low, and disable protected mode if on.
将“本地 Intranet”区域设置为低,如果打开则禁用保护模式。
That should stop that message from being displayed. If that doesn't work, set a 'custom level' to allow javascript to run locally.
这应该会阻止显示该消息。如果这不起作用,请设置“自定义级别”以允许 javascript 在本地运行。