Cross origin requests are only supported for HTTP

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Cross origin requests are only supported for HTTP相关的知识,希望对你有一定的参考价值。

问题通过Ajax请求本地文件,跨域报错。
Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
解决方法一:
(1)找到chrome安装目录
我的在C:\Users\Administrator\AppData\Local\Google\Chrome\Application这里.
技术分享图片
(2) 在命令行启动chrome
从命令行进入到chrome安装目录,然后,start chrome.exe --allow-file-access-from-files

解决方法二:
将整个文件部署到服务器上

以上是关于Cross origin requests are only supported for HTTP的主要内容,如果未能解决你的问题,请参考以下文章

本地数据访问时出现跨域问题Cross origin requests are only supported for protocol schemes: ……

chrome错误Cross origin requests are only supported for protocol schemes: http, data,chrome-extension

nodejs报错 XMLHttpRequest cannot load localhost:3000/test_date/. Cross origin requests are only suppor

Cross origin requests are only supported for protocol schemes: http, data, chrome,chrome-extension的问

Ajax本地跨域问题 Cross origin requests are only supported for HTTP(针对jQuery基础教程第四版第六章)

第134篇:解决浏览器的CORS跨域问题(CORS policy: Cross origin requests are only supported for protocol schemes: htt