Get device type on accessing your website

Find which device has accessed your website: See the javascript code below

function GetDeviceType(){
           if( navigator.userAgent.match(/Android/i) ||
              navigator.userAgent.match(/webOS/i) ||
              navigator.userAgent.match(/iPhone/i) ||
              navigator.userAgent.match(/iPod/i) ||
               alert('Device type is ::'+navigator.userAgent);
            }else if(navigator.userAgent.match(/Windows/)){
   alert(' Device type is :: Windows:::'+navigator.userAgent);
}else if(navigator.userAgent.match(/Linux/)){
   alert(' Device type is : Linux:::'+navigator.userAgent);
              alert(' Other Device:::'+navigator.userAgent);


If somebody knows Jquery code for this, update this post or comment here.

Popular posts from this blog

Can not connect to git using ssh (Permissions 0644 for '/root/.ssh/id_rsa' are too open.

Session timeout interceptor in struts 2