我的草稿网站可以在 FireFox 和 IE 以及 Android Chrome 中运行,但不能在桌面版 Chrome 中运行。桌面版 Chrome 给我这个错误
“未捕获的 DOMException:无法在‘XMLHttpRequest’上执行‘发送’”
。
网站网址:http://beyondproxima.appspot.com
XmlHttpRequest 中加载的 URL:http://beyondproxima.appspot.com/data.json
Chrome 版本失败:56.0.2924.87 (Win 7)
此错误通常是跨源脚本问题,但我正在尝试从同一域、端口等(同步)加载 JSON 文件...
Chrome 是否因为我执行的是过时且已弃用的同步请求而阻止了我的请求?
最佳答案
在我的 chrome 中,您的 url 工作正常并且正在加载数据。
chrome 中有警告信息
"Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/."
我认为这只是浏览器问题,没有其他问题。只需更新您的 chrome。
Chrome 56.0
避免发出同步请求。
而不是这个..
xmlHttp.open("GET", "http://google.com", false);
使用 true
代替 false
。
关于javascript - 无法在 'send' 上执行 'XMLHttpRequest'(但不是跨源问题),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42244020/