Disabling same-origin policy in Safari

后端 未结 5 969
忘掉有多难
忘掉有多难 2020-11-29 04:28

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

相关标签:
5条回答
  • 2020-11-29 04:46

    goto,

    Safari -> Preferences -> Advanced

    then at the bottom tick Show Develop Menu in menu bar

    then in the Develop Menu tick Disable Cross-Origin Restrictions

    0 讨论(0)
  • 2020-11-29 04:53

    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.

    0 讨论(0)
  • 2020-11-29 04:59

    If you want to disable the same-origin policy on Safari (I have 9.1.1), then you only need to enable the developer menu, and select "Disable Cross-Origin Restrictions" from the develop menu.

    0 讨论(0)
  • 2020-11-29 05:05

    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.

    0 讨论(0)
  • 2020-11-29 05:08

    There is an option to disable cross-origin restrictions in Safari 9, different from local file restrictions as mentioned above.

    0 讨论(0)
提交回复
热议问题