Search code examples
intel-xdk

Load Url in Web View Intel Xdk


I want to convert my website to mobile application with Intel XDK. So , how to do this with web view.I want to load the URL on the current web view not open it on a new page with the native browser.


Solution

  • Easy way is to use window.location= to load URL:

    <!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>
    </head>
    <body>
        <script>
            window.location = "http://www.yourwebsite.com";
        </script>    
    </body>
    </html>
    

    Better way is to use InAppBrowser and connection Cordova plugins to load website, so that you can handle connection loss and reload, it will load complete website in background and then display, here is code: https://github.com/krisrak/html5-cordova-webapp