cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tim...@apache.org
Subject spec commit: [CB-2600] - fix for mobile spec not loading on blackberry
Date Fri, 08 Mar 2013 21:44:55 GMT
Updated Branches:
  refs/heads/CB-2600 [created] b6684761e


[CB-2600] - fix for mobile spec not loading on blackberry


Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/b6684761
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/b6684761
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/b6684761

Branch: refs/heads/CB-2600
Commit: b6684761e5838dfc88dbcf1995cb6abc072c7cc1
Parents: 9d9f919
Author: timkim <timkim@apche.org>
Authored: Fri Mar 8 13:44:42 2013 -0800
Committer: timkim <timkim@apche.org>
Committed: Fri Mar 8 13:44:42 2013 -0800

----------------------------------------------------------------------
 cordova.js |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/b6684761/cordova.js
----------------------------------------------------------------------
diff --git a/cordova.js b/cordova.js
index 5c3922f..cbd8c7a 100644
--- a/cordova.js
+++ b/cordova.js
@@ -20,7 +20,7 @@
 */
 
 var VERSION='2.5.0';
-var PLAT = /Android/.exec(navigator.userAgent) ? 'android' : 'ios';
+var PLAT = getPlatform();
 
 var scripts = document.getElementsByTagName('script');
 var currentPath = scripts[scripts.length - 1].src;
@@ -30,7 +30,7 @@ var cordovaPath = versionCordovaPath;
 
 (function() {
     var xhr = new XMLHttpRequest();
-    xhr.open("GET", platformCordovaPath, false);
+    xhr.open("GET", platformCordovaPath, true);
     xhr.onreadystatechange = function() {
         if (this.readyState == this.DONE && this.responseText.length > 0) {
             cordovaPath = platformCordovaPath;
@@ -51,3 +51,13 @@ function backHome() {
 	    window.history.go(-1);
 	}
 }
+
+function getPlatform(){
+    if(/Android/.exec(navigator.userAgent)){
+        return 'android';
+    }else if(navigator.userAgent.indexOf("BB10") > -1 || navigator.userAgent.indexOf("PlayBook")
> -1 || navigator.userAgent.indexOf("BlackBerry") > -1) {
+        return 'blackberry';
+    }else{
+        return 'ios';
+    }
+}
\ No newline at end of file


Mime
View raw message