Reputation: 203
I'm trying to deploy a Cordova project to put my website into an iOS & Android mobile app.
According to 2 tutorials (https://auth0.com/blog/converting-your-web-app-to-mobile/ & https://www.youtube.com/watch?v=LjIKElAP6_A), I had to edit index.html
.
First tutorial config :
<!doctype html>
<html lang="en" data-framework="javascript">
<head>
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script type="text/javascript">
function onBodyLoad()
{
document.addEventListener("deviceready", onDeviceReady, false);
window.location.href = "https://www.website.com/";
}
function onDeviceReady()
{
// do your thing!
}
</script>
<script type="text/javascript" charset="utf-8" src="phonegap-1.3.0.js"></script>
</head>
<body onload="onBodyLoad()">
</body>
</html>
Second tutorial config :
<!doctype html>
<html lang="en" data-framework="javascript">
<head>
<script>
function onDeviceReady() {
if (navigator.connection.type == Connection.NONE) {
navigator.notification.alert('An internet connection is required to continue');
} else {
window.location="https://www.website.com";
}
}
document.addEventListener("deviceready", onDeviceReady, false);
</script>
</head>
<body>
<script src="node_modules/todomvc-common/base.js"></script>
<script src="js/helpers.js"></script>
<script src="js/store.js"></script>
<script src="js/model.js"></script>
<script src="js/template.js"></script>
<script src="js/view.js"></script>
<script src="js/controller.js"></script>
<script src="js/app.js"></script>
</body>
</html>
The second one is not working at all, but with the first config of index.html
, the app opens with white screen and opens right after Safari or Chrome with the website in the url bar. But i'm looking for a real mobile app behaviour...
Somebody can help me with this and find a working config to obtain a mobile app behaviour ? Many thanks
Upvotes: 0
Views: 60
Reputation: 136
there is an easiest way of converting a website to an IOS and Android using cordova. I am going to give you a guide line of how to do it easily without complications.(you must have cordova,Xcode and Android Studio) installed on your computer.
First step is to create a cordova project.
NEXT STEPS
Upvotes: 1