欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

前端跨域问题

程序员文章站 2024-02-21 22:25:22
...

JavaScript出于安全方面的考虑,不允许跨域调用其他页面的对象。但在安全限制的同时也给注入iframe或是ajax应用上带来了不少麻烦。

Mac:
chrome49以前版本

open -a "Google Chrome" --args --disable-web-security
chrome49以后版本

open -a /Applications/Google\ Chrome.app --args --disable-web-security --user-data-dir

Safari

open -a '/Applications/Safari.app' --args --disable-web-security
  • 1

Window:

chrome.exe --disable-web-security
  • 1

PS:Mac–>Chrome如果命令行不成功可以安装一个插件Allow-Control-Allow-Origin