Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
459 views
in Technique[技术] by (71.8m points)

javascript - 在Chrome中禁用同一来源政策(Disable same origin policy in Chrome)

有什么方法可以在Google的Chrome浏览器上禁用同源策略

  ask by Landon Kuhn translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Yep.(是的)

For OSX, open Terminal and run:(对于OSX,打开终端并运行:) $ open -a Google Chrome --args --disable-web-security --user-data-dir --user-data-dir required on Chrome 49+ on OSX(--OSX上的Chrome 49+需要--user-data-dir) For Linux run:(对于Linux运行:) $ google-chrome --disable-web-security Also if you're trying to access local files for dev purposes like AJAX or JSON, you can use this flag too.(另外,如果您尝试出于开发目的(例如AJAX或JSON)访问本地文件,也可以使用此标志。) -–allow-file-access-from-files For Windows go into the command prompt and go into the folder where Chrome.exe is and type(对于Windows,请进入命令提示符并进入Chrome.exe所在的文件夹,然后键入) chrome.exe --disable-web-security That should disable the same origin policy and allow you to access local files.(那应该禁用相同的原始策略,并允许您访问本地文件。) Update: For Chrome 22+ you will be presented with an error message that says:(更新:对于Chrome 22+,您将看到一条错误消息,内容为:) You are using an unsupported command-line flag: --disable-web-security.(您正在使用不受支持的命令行标志:--disable-web-security。) Stability and security will suffer.(稳定性和安全性将受到损害。) However you can just ignore that message while developing.(但是,您可以在开发时忽略该消息。)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...