Skip to content

Commit

Permalink
device detection and include proper cordova lib for iphone/android
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbie1o1 committed May 4, 2012
1 parent 5c66c66 commit 060e6f0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions index.html
Expand Up @@ -9,11 +9,22 @@
<link rel="stylesheet" href="css/jquery.mobile.structure.css" />
<link rel="stylesheet" href="css/jquery.mobile.theme.css" />

<script src="js/lib/cordova-iphone.js"></script>
<!-- <script src="js/lib/cordova-android.js"></script> -->
<script>
var userAgent = navigator.userAgent + '';
if (userAgent.indexOf('iPhone') > -1) {
document.write('<script src="js/lib/cordova-iphone.js"></sc' + 'ript>');
var mobile_system = 'iphone';
} else if (userAgent.indexOf('Android') > -1) {
document.write('<script src="js/lib/cordova-android.js"></sc' + 'ript>');
var mobile_system = 'android';
} else {
var mobile_system = '';
}
</script>

<script src="js/lib/jquery.js"></script>
<!-- your scripts here -->
<script src="js/app/app.js"></script>
<script src="js/app/bootstrap.js"></script>
<script src="js/lib/jquery.mobile.js"></script>

Expand Down
2 changes: 1 addition & 1 deletion js/app/bootstrap.js
Expand Up @@ -3,7 +3,7 @@
var jqm_mobile_init = false;

var initApp = function() {
if (device_ready && jqm_mobile_init) {
if ((device_ready && jqm_mobile_init) || (jqm_mobile_init && !mobile_system)) {
startApp();
}
};
Expand Down

0 comments on commit 060e6f0

Please sign in to comment.