Cross origin requests are only supported for protocol schemes: http, data, chrome-extension, https, chrome-extension-resource. 报错处理

今天调试程序的时候,chrome出现报错:Cross origin requests are only supported for protocol schemes: http, data, chrome-extension, https, chrome-extension-resource.

原因:

Chrome内核浏览器请求本地json数据会出现错误:

解决方法:

在chrome的快捷方式-目标后边添加 空格 --allow-file-access-from-files 确定即可

运行效果:第一次直接把html文件拖到此快捷方式中,之后用DWcs6打开运行也不报错了(dw默认的是chrome运行效果)。

原文地址:https://www.cnblogs.com/monozxy/p/4975134.html