问题描述
因为iOS 12 Safari是跨域请求,所以自从iOS 12 Safari阻止我的URL要求提供凭据以来.在iOS 11上一切正常.因此,我认为所有标头均已正确设置.
Since iOS 12 Safari blocks my url from asking for credentials because it's a cross-origin request. Everything worked fine with iOS 11. So I think that all headers are set right.
控制台输出为:
Blocked *URL* from asking for credentials because it is a cross-origin request.
我在发行说明中找不到任何指示可能已更改的内容.
I can't find anything in the release notes that indicates what may have changed.
https://developer.apple.com/documentation/safari_release_notes/safari_12_release_notes
您是否知道苹果在Safari 12中进行了哪些更改,以提高安全性/阻止跨源请求以要求提供凭据?
Does anybody of you know what Apple changed in Safari 12 to increase the security / block cross-origin requests from asking for credentials?
感谢您的帮助!
推荐答案
在脚本元素中添加 crossorigin
应该可以根据.示例:
Adding crossorigin
to the script element should fix this issue according to this answer.Example:
<script src="my-code.js" type="module" crossorigin></script>
另请参见 https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes
这篇关于Safari因为是跨域请求而阻止URL要求提供凭据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!