Phonegap/Cordova App device detection isn't working on iOS -


i'm young developer who's school project went viral amongst school , turned app. i'm using phonegap i'm advanced in web languages. decided cater devices, built iphone layout. make on ipad, used cordova device detection implement changes (i know bad) this:

//checks device being used var devicetype = (navigator.useragent.match(/ipad/i))  == "ipad" ? "ipad" : (navigator.useragent.match(/iphone/i))  == "iphone" ? "iphone" : (navigator.useragent.match(/android/i)) == "android" ? "android" : (navigator.useragent.match(/blackberry/i)) == "blackberry" ? "blackberry" : "null"; //width & height tannock image var width = 178.5; var height = 270; //if device ipad if(devicetype == "ipad"){  $('#teaimg').css('height', '540px');     $('#teaimg').css('width', '357px');     $('#text1').css('margin-left', '38%'); $('#text1').css("font-size", '35px');     width = 357; height = 270;     } 

this shocking code working absolutely fine when directly fed ipad through xcode, when downloaded app store, no longer working , instead of looking wanted to, didn't apply of these changes.

does know how fix this?

p.s app called tannock tapper, know it's buggy, i'm 1 man team , school takes priority.

i fixed code according device orinted following:

i set code in format use.

var isandroid = navigator.useragent.match(/android/i) ? true : false; var isiphone = navigator.useragent.match(/iphone/i) ? true : false; var isipad = navigator.useragent.match(/ipad/i) ? true : false; var isblackberry = (navigator.useragent.match(/blackberry/i)) ? true : false;   var width = 178.5; var height = 270;  //if device ipad if(isipad){      $('#teaimg').css('height', '540px');         $('#teaimg').css('width', '357px');         $('#text1').css('margin-left', '38%');     $('#text1').css("font-size", '35px');         width = 357;     height = 270;     }  // if device android if(isandroid){ // android related code }  if(isblackberry){ // black berry related code. } 

i have same code in app , using code last 3 years in app in app store.

ping me if looks confusing.


Comments

Popular posts from this blog

Combining PHP Registration and Login into one class with multiple functions in one PHP file -

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -