Chrome浏览器开发技巧

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_30682027/article/details/80509027

Chrome浏览器开发技巧

Ajax本地跨域问题 Cross origin requests are only supported for HTTP

浏览器为了安全性考虑,默认对跨域访问禁止。

解决:给Chrome浏览器传入启动参数(allow-file-access-from-files),允许跨域访问。
Windows下,运行(CMD+R)或建立快捷方式:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --allow-file-access-from-files

XMLHttpRequest cannot load Origin * is not allowed by Access-Control-Allow-Origin

给Chrome浏览器传入启动参数 --args --disable-web-security就可以屏蔽安全访问了[ –args:此参数可有可无],然后就随意的调用不同域下的数据了。

猜你喜欢

转载自blog.csdn.net/qq_30682027/article/details/80509027