Search code examples
crosswalk-runtime

Is there a way to turn off same origin policy on the crosswalk webview for certain iframes?


I'm using the crosswalk webview on a project. I need some javascript to access elements which are on an iframe from a different origin but the same origin policy throws an error. Is there a way on crosswalk to turn this security check off?

Thanks.


Solution

  • Crosswalk supports all command line option that Chromium has, so, to disable samle origin policy, you can use --disable-web-security switch.

    If you are using make_apk tool to package your application, you can use the following option: python make_apk.py --xwalk-command-line='--disable-web-security' ...

    https://github.com/crosswalk-project/crosswalk-website/wiki/use-chromium-command-lines-in-your-apps-on-android

    Or if you are embedding Crosswalk WebView directly, you can just write a plain text file named xwalk-command-line into the assets of your project, the content of the text file should be walk --disable-web-security.