December 2013
Intermediate to advanced
384 pages
9h 54m
English
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test( navigator.userAgent) ) { . . . mobile code here . . . }
You can use the following JavaScript and regex statement to parse the navigator.userAgent value and determine whether a user is coming into your web site on a mobile device:
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/ i.test(navigator.userAgent) ) { }
The statement parses the userAgent attribute and tries to find the most common strings incorporated in the mobile browsers.
Read now
Unlock full access