如何允许在Safari跨域请求? [英] How to allow cross-domain requests in Safari?
问题描述
我有我web应用从本地主机(因为调试)运行,这使得跨域AJAX请求。我可以轻松地设置标志的镀铬 - 禁用网络安全和web应用程序将按预期在Chrome中。但我需要做到这一点的Windows上的Safari也。有一些类似的标志或者我可以把这个在preferences地方?
I have webapp I run from localhost (because of debugging) and it makes cross-domain AJAX requests. I can easily set flag for Chrome "--disable-web-security" and the webapp works as expected in Chrome. But I need to do this for Safari on Windows as well. Is there some similar flag or can I set this in Preferences somewhere ?
感谢您的帮助。
推荐答案
解决方案是设置一个头访问控制 - 允许 - 产地:*
在服务器上的
Solution is to set a header Access-Control-Allow-Origin: *
on the server.
在PHP中很容易像这样的:
In PHP it's easy like this:
header("Access-Control-Allow-Origin: *");
信贷的答案去Brain2000,感谢这表明在您的评论的链接。
Credit for the answer goes to Brain2000, thanks for suggesting a link in your comment.
这篇关于如何允许在Safari跨域请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!