ajax请求resource文件Access to XMLHttpRequest at 'file:'

error:
jsPractise.html:24 Access to XMLHttpRequest at ‘file:///E:/…’ from origin ‘null’ has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
解决方法:
右键chrome快捷方式–》属性 在下图的目标中添加 --allow-file-access-from-files
**注意:**前面是有空格。
重启chrome, 打开.html文件。
ajax请求resource文件Access to XMLHttpRequest at 'file:'_第1张图片

你可能感兴趣的:(ajax)