jquery读取本地文件,Windows上报错。XMLHttpRequest cannot load xxx. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.k.cors.a.c

时间:2021-08-02 03:47:40
问题:
测试报告,使用本地的json.txt文件,结果文件读取失败,报错如下:
XMLHttpRequest cannot load xxx. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.k.cors.a.crossDomain.send @ jquery.min.js:4
 
解决方法:
在浏览器快捷键上右键选择属性(chrom和360都支持),目标,在exe后增加 --allow-file-access-from-files
jquery读取本地文件,Windows上报错。XMLHttpRequest cannot load xxx. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.k.cors.a.c