Cordova loads the remote site into the app
I have a website that I have coded with jQuery and HTML5. I would like to use a simple IOS and Android framework that loads my site into an application - essentially an internal browser. Clicking on a link in the app will take you to that remote page inside the app.
I tried to set the location in index.html using Cordova, but loaded the external site into the device browser, not the application:
<html lang="us">
<head>
<meta charset="utf-8">
<title>Test</title>
<script src="cordova.js"></script>
<script type="text/javascript">
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
// Now safe to use the Codova API
window.location="http://www.test.com";
}
</script>
</head>
<body>
</body>
</html>
How do I load my remote site using Cordova so that the application is essentially a web browser? Is there a better / simpler solution other than Cordova for this?
+1
source to share
1 answer
Install in Application Browser
cordova plugin add cordova-plugin-inappbrowser
then in the code
var options = {
location: 'yes',
clearcache: 'yes',
toolbar: 'no'
};
$cordovaInAppBrowser.open('http://yoururlhere.com', '_blank', options)
See cordova in the app browser documentation for details
+5
source to share