chrome报错【Access to XMLHttpRequest at ‘file:///ceshi.json’ from origin ‘null’ has been blocked by COR
2020-01-15 10:20
4167 查看
chrome报错【Access to XMLHttpRequest at ‘file:///ceshi.json’ from origin ‘null’ has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https】
原因: 浏览器(Webkit内核)的安全策略决定了file协议访问的应用无法使用XMLHttpRequest对象
解决:
- Windows:
设置Chrome的快捷方式属性,在“目标”后面加上–allow-file-access-from-files,注意前面有个空格,重新打开Chrome即可。
- Mac:
只能通过终端打开浏览器:打开终端,输入下面命令:open -a “Google Chrome” --args --disable-web-security然后就可以屏蔽安全访问了[ --args:此参数可有可无]
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- ajax post上传数据时,前端出现的跨域权限问题:ccess to XMLHttpRequest at ‘’rom origin 'null' has been blocked by CORS ...
- XmlHttpRequest error: Origin null is not allowed by Access-Control-Allow-Origin
- jquey XMLHttpRequest cannot load url.Origin null is not allowed by Access-Control-Allow-Origin
- Image from origin 'http://bubuol.com' has been blocked from loading by Cross-Origin Resource Sharing
- vuecli3[跨域代理配置]-Access to XMLHttpRequest at 'xxx' by CORS跨域问题前端解决方式
- 如何解决XMLHttpRequest cannot load file~~~~~~~Origin 'null' is therefore not allowed access
- XmlHttpRequest error: Origin null is not allowed by Access-Control-Allow-Origin
- XMLHttpRequest在请求失败(Origin null is not allowed by Access-Control-Allow-Origin.)
- 如何解决XMLHttpRequest cannot load file~~~~~~~Origin 'null' is therefore not allowed access
- 问题:XMLHttpRequest cannot load file~~Origin 'null' is therefore not allowed access
- 如何解决XMLHttpRequest cannot load file~~~~~~~Origin 'null' is therefore not allowed access
- XMLHttpRequest在请求失败(Origin null is not allowed by Access-Control-Allow-Origin.)
- (转)XMLHttpRequest在请求失败(Origin null is not allowed by Access-Control-Allow-Origin.)
- ' from origin 'null' has been blocked by CORS policy: Invalid response. Origin 'null' is therefore n
- 如何解决XMLHttpRequest cannot load file~~~~~~~Origin 'null' is therefore not allowed access
- 如何解决XMLHttpRequest cannot load file~~~~~~~Origin 'null' is therefore not allowed access
- Get json formatted string from web by sending HttpWebRequest and then deserialize it to get needed data
- Font from origin 'http://apps.bdimg.com' has been blocked
- Font from origin 'http://apps.bdimg.com' has been blocked
- 使用chrome调试ajax加载本地文件的时候出现Failed to load resource: Origin null is not allowed by Access-Control-Allow