Search code examples
cordovaintel-xdk

is it possible to embed a 'X-Frame-Options: SAMEORIGIN" website in phoneGap?


Is there a way to have a ("X-Frame-Options: SAMEORIGIN") website in phonegap:

or in opthers terms : I want to embed google.com inside my phonegap application: is this possible ? (I tried with iframe and no way)

(I use intel SDK crosswalk)


Solution

  • You can use the Cordova In-App-Browser plugin to open external websites. This will pop open a modal window with the website you specify.

    Below is example code to open google.com, make sure you have checked the "In App Browser" plugin from the Intel XDK -> project settings - > Plugins

    <!DOCTYPE html>
    <html>
        <head>
            <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=no">
            <script src="cordova.js"></script>
            <script>   
    function openIAB(){
        var url = "http://google.com";
        window.open(url, "_blank", "location=yes");
    }            
            </script>    
        </head>
        <body>
            <button onclick="openIAB()">Open Google</button>
        </body>
    </html>
    

    documentation for In App Browser cordova plugin: https://github.com/apache/cordova-plugin-inappbrowser