Search code examples
phonegap

create a phone Gap app by just passing the url of website


I have created a phone gap app by just passing the url of my developed website into my PhoneGap project but in the app addressbar is coming want to remove that

document.addEventListener("deviceready", onDeviceReady, false);

            function onDeviceReady() {                 
                window.open('http://hitchmeright.com', '_self ', 'location=yes');
            }
        </script>

Solution

  • Your app is likely opening the url in the InAppBrowser. From the InAppBrowser docs:

    _self: Opens in the Cordova WebView if the URL is in the white list, otherwise it opens in the InAppBrowser.

    So you need to whitelist your url.

    Now that said, this is not a good design for a PhoneGap application, and will likely provide a terrible user experience. You're treating PhoneGap as a browser rather than a hybrid app. You should build your PhoneGap app properly (package your web assets and load them locally), and only load data from the server as needed. I'd recommend doing a bit more research and checking out some example apps.