Here's a little script to help newbies with detecting what type of visitor they are having.
Detect Googlebot:
Detect Android:
Detect iPhone and iPad:
For best cloacking you should Always also check server-side, for example IP address.
Detect Googlebot:
Code:
var isGoogle = navigator.userAgent.toLowerCase().indexOf('googlebot') > 0;
Detect Android:
Code:
var isAndroid = navigator.userAgent.toLowerCase().indexOf('android') > 0;
Detect iPhone and iPad:
Code:
var isApple = navigator.userAgent.toLowerCase().indexOf('iphone') > 0 || navigator.userAgent.toLowerCase().indexOf('ipad') > 0;
For best cloacking you should Always also check server-side, for example IP address.
Last edited: