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

Posted vincent_duan

tags:

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

使用ajax请求本地文件,chrome会报跨域错误。

XMLHttpRequest cannot loadfile:///C:/Users/Li/Desktop/images/alist.json.Cross origin requests are only supported for protocol schemes: http, data,chrome-extension, https, chrome-extension-resource.

解决方法:

给chrome添加启动参数:--allow-file-access-from-files。

具体方法:

在浏览器快捷方式上右键-属性-快捷方式-目标 如下图:

技术分享

 

以上是关于chrome错误Cross origin requests are only supported for protocol schemes: http, data,chrome-extension的主要内容,如果未能解决你的问题,请参考以下文章

服务器返回 CORS 标头,浏览器仍然抛出 Cross-Origin Request Blocked 错误

Cross origin requests are only supported for HTTP

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

使用 Chrome/WebKit 调试 Access-Control-Allow-Origin

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

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