如何使用Javascript在Google Chrome中禁用网络安全?
问题描述:
我通过以下命令在命令提示符下禁用谷歌浏览器中的websecurity
startchromeC:\Program Files(x86)\Google \ Chrome \ Application \ chrome .exe - allow-file-access-from-files --disable-web-security ..
它对我有用..
但是每次我都需要运行命令提示符。所以我想让它成为默认行为,而不必每次都打开终端/命令行或自定义快捷方式。
I disabled websecurity in google chrome from command prompt by the following command
start "chrome" "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --allow-file-access-from-files --disable-web-security ..
It worked for me..
But every time i need to run the command prompt .So i want to make this the default behavior without having to open a terminal/command line or a custom shortcut every time.
答
你不要't。
安全功能的重点是阻止 javascript执行危险操作。如果有办法通过javascript禁用它,那么它根本不会提供任何保护。
You don't.
The whole point of the security features is to prevent javascript from performing dangerous actions. If there was a way to disable it through javascript, then it wouldn't provide any protection at all.