在 Safari 10.1 上尝试 CORS 请求 时,在包含查询参数(例如 https://example.com/api?v=1),Safari 说
When trying a CORS request on Safari 10.1, on an URL which includes query parameters (e.g. https://example.com/api?v=1), Safari says
XMLHttpRequest 由于访问控制检查而无法加载
XMLHttpRequest cannot load due to access control checks
Chrome/Firefox 运行良好.
Chrome/Firefox works fine.
对于来自没有 ?v=1 的页面的请求,Safari 也可以正常工作.
On requests from the page without the ?v=1, Safari works fine too.
我尝试从
Access-Control-Allow-Origin: https://example.com
到
Access-Control-Allow-Origin: https://example.com/api?v=1
但这会破坏 Chrome.
but that breaks Chrome.
有什么建议吗?
如果有人遇到这个错误,它只是发生在我正在构建的应用程序中.就我而言,它原来是 uri 中的尾随/,导致 301 响应,出于某种原因,Safari 将其解释为 500 响应.
If anyone comes across this error, it just occurred in the application I was building. In my case, it turned out to be a trailing / in the uri, which caused a 301 response, which was for some reason interpreted by Safari as a 500 response.
这篇关于Safari 10.1:由于访问控制检查,无法加载带有查询参数的 XMLHttpRequest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
即使在调用 abort (jQuery) 之后,浏览器也会等待Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在调用 abort (jQuery) 之后,浏览器也会等待 ajax 调用
JavaScript innerHTML 不适用于 IE?JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不适用于 IE?)
XMLHttpRequest 无法加载,请求的资源上不存在“AXMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 无法加载,请求的资
XHR HEAD 请求是否有可能不遵循重定向 (301 302)Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 请求是否有可能不遵循重定向 (301 302))
XMLHttpRequest 206 部分内容XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分内容)
XMLHttpRequest 的 getResponseHeader() 的限制?Restrictions of XMLHttpRequest#39;s getResponseHeader()?(XMLHttpRequest 的 getResponseHeader() 的限制?)