Permalink
Browse files

device detection and include proper cordova lib for iphone/android

  • Loading branch information...
sebbie1o1 committed May 4, 2012
1 parent 5c66c66 commit 060e6f047c2d06faabd4c13a17340d62490dab39
Showing with 14 additions and 3 deletions.
  1. +13 −2 index.html
  2. +1 −1 js/app/bootstrap.js
View
@@ -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>
View
@@ -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();
}
};

0 comments on commit 060e6f0

Please sign in to comment.