JavaScript mobile device detection -


i using following javascript codes detect either user devices phones or tablets (i have detect either device in portrait mode or in landscape mode):

function getdevicetype() {     if(window.innerwidth>=320 && window.innerheight <=650) {         return true;     } else {         return false;     } } 

it working fine until got new nexus 7 device , not working. preventing sniff user-agent , want device resolutions. how can detect if user using "smart phone" (should detect whether phone in landscape or in portrait mode) , same tablets well.

please advice.

i don't know why question down-voted. got solution problem:

function getdevicetype() {     return (window.innerwidth>=320 && window.innerwidth<959) && (window.innerheight>=212 && window.innerheight<799) ? true : false; } 

this resolved issues nexus well.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -