一直以为safari很垃圾,没想到这么人性。
问题:本地写了个html,访问了一个网站的ajax请求。
报错如下:
[Error] Origin null is not allowed by Access-Control-Allow-Origin.
[Error] XMLHttpRequest cannot load https://www.baidu.com/ due to access control checks.
[Error] Failed to load resource: Origin null is not allowed by Access-Control-Allow-Origin. (www.baidu.com, line 0)
原因:跨域了。
解决方案:
1.把safari的开发菜单展示出来
safari浏览器 -> 偏好设置 -> 高级 -> 勾选最底部的开发菜单
2.在safari浏览器顶部“开发”菜单项中,勾选停用跨源限制

网友评论