jquery - How to detect Blackberry mobile/playbook and Windows phone by Javascript? -


by article http://www.abeautifulsite.net/blog/2011/11/detecting-mobile-devices-with-javascript/ able detect iphone,ipod,ipad,android device. how can detect blackberry mobile/playbook , windows phones?

you can detect blackberry devices using:

navigator.useragent.match(/blackberry|bb|playbook/i); 

you can detect windows devices using:

navigator.useragent.match(/iemobile|windows phone/i); 

however, if trying detect if user on mobile device, recommend using code:

if (/android|webos|iphone|ipad|ipod|blackberry|bb|playbook|iemobile|windows phone|kindle|silk|opera mini/i.test(navigator.useragent)) {     // mobile users. } else {     // non-mobile users. } 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -