Search code examples
javascriptwebkitxmlhttprequestwebviewsame-origin-policy

Disable the Same Origin Policy / making cross domain XMLHttpRequests in WebKit WebViews?


I would like to disable the same origin policy on XMLHttpRequests in my own embedded WebViews. I have control over the pages loaded / code being executed in the WebView, so I do not care about enforcing the same origin policy. I would like to make cross-domain requests.

I've tried implementing the WebPolicyDelegate and WebResourceLoadDelegate but they do not seem to be called for XMLHttpRequests.


Solution

  • void WebSettingsImpl::setWebSecurityEnabled(bool enabled)
    {
        m_settings->setWebSecurityEnabled(enabled);
    }
    

    Hopefully this is what you need! You can send me a message for webkit.