How to allow cross-domain requests in Safari?

2019-02-15 23:15发布

问题:

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 ?

Thanks for help.

回答1:

Solution is to set a header Access-Control-Allow-Origin: * on the server.

In PHP it's easy like this:

header("Access-Control-Allow-Origin: *");

Credit for the answer goes to Brain2000, thanks for suggesting a link in your comment.