To check if the userAgent is a mobile device in jQuery you can use the following snippet.
It will match the following:
- • Android
- • webOS
- • iPhone
- • iPad
- • iPod
- • BlackBerry
Sample jQuery
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/.test(navigator.userAgent) ) { // mobile device } else { // other device }
RT @CodeSnippetsNET: check if userAgent is mobile device: http://t.co/UxyIbU9DlZ #js #jquery
RT @CodeSnippetsNET: check if userAgent is mobile device: http://t.co/UxyIbU9DlZ #js #jquery