For development purposes, I need to disable the same-origin policy in Safari (on Windows) on my machine.
In Chrome, this can be done by launching with the flag --disable-web-security
. Is there an equivalent flag or hidden setting in Safari?
Later versions of Safari allow you to Disable Cross-Origin Restrictions. Just enable the developer menu from Preferences >> Advanced, and select "Disable Cross-Origin Restrictions" from the develop menu.
If you want local only, then you only need to enable the developer menu, and select "Disable local file restrictions" from the develop menu.
Unfortunately, there is no equivalent for Safari and the argument --disable-web-security
doesn't work with Safari.
If you have access to the server side application, you can modify the https response headers to allow access. Mainly the Access-Control-Allow-Origin
header. Modifying it will allow Safari to access the resource. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS#Access-Control-Allow-Origin for more information on the response headers that will help.
Most of these answers are old. The latest Safari 14.0.2 (in 2021), has the option to Disable Cross-Origin Restrictions
, however, it doesn't work if the paths have ../../ kind of path names; even though Safari correctly resolves to a local file path, it still doesn't permit loading the file, even though it exists. This is a recent bug in Safari 14 that didn't happen in 13.