加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-16 02:03:50 所属栏目:百科 来源:网络整理
导读:问题: 打开本地html文件时,报错如下 Cross origin requests are only supported for protocol schemes: http,data,chrome-extension,https,chrome-extension-resource. 分析: 浏览器为了安全性考虑,默认对跨域访问禁止。 解决: 给浏览器传入启动参数(

问题: 打开本地html文件时,报错如下
Cross origin requests are only supported for protocol schemes: http,data,chrome-extension,https,chrome-extension-resource.

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

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

参考资料:
https://stackoverflow.com/questions/10752055/cross-origin-requests-are-only-supported-for-http-error-when-loading-a-local/23758738#23758738

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读