How to detect iPhone 6 and 6 Plus via JavaScript/jQuery (or PHP)? -


is there way detect iphone 6 , 6 plus via javascript or php ? need boolean value conditional if else in jquery. it's web app in safari (or uiwebview). tried detect screen resolution because of meta viewport or pixel ration (i don't know) output value same on iphone 5, iphone 6 , 6 plus. in advance !

with javascript combination of 2 methods:

function iphoneversion() {    var iheight = window.screen.height;    var iwidth = window.screen.width;    if (iwidth === 320 && iheight === 480) {      return "4";    }    else if (iwidth === 375 && iheight === 667) {      return "6";    }    else if (iwidth === 414 && iheight === 736) {      return "6+";    }    else if (iwidth === 320 && iheight === 568) {      return "5";    }    else if (iheight <= 480) {      return "2-3";    }    return 'none';  }    function isiphone() {    return !!navigator.useragent.match(/iphone/i);  }

so need test if it's iphone , version:

if ( isiphone() && iphoneversion() === "6"){    //code..  }


Comments

Popular posts from this blog

tcpdump - How to check if server received packet (acknowledged) -