diff --git a/js/utils/platform.js b/js/utils/platform.js index 94f3110ca2..e4cf3b61c4 100644 --- a/js/utils/platform.js +++ b/js/utils/platform.js @@ -1,5 +1,12 @@ (function(window, document, ionic) { + function getParameterByName(name) { + name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); + var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), + results = regex.exec(location.search); + return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); + } + var IOS = 'ios'; var ANDROID = 'android'; var WINDOWS_PHONE = 'windowsphone'; @@ -206,8 +213,12 @@ * @private */ setPlatform: function(n) { + var override; + if (typeof n != 'undefined' && n !== null && n.length) { platformName = n.toLowerCase(); + } else if(override = getParameterByName('ionicplatform')) { + platformName = override; } else if (this.ua.indexOf('Android') > 0) { platformName = ANDROID; } else if (this.ua.indexOf('iPhone') > -1 || this.ua.indexOf('iPad') > -1 || this.ua.indexOf('iPod') > -1) {