Skip to content

Instantly share code, notes, and snippets.

@oleksapro
Last active August 29, 2015 14:26
Show Gist options
  • Save oleksapro/32754f3f22bc523f93f5 to your computer and use it in GitHub Desktop.
Save oleksapro/32754f3f22bc523f93f5 to your computer and use it in GitHub Desktop.
function browser() {
var ua = navigator.userAgent;
if (ua.search(/MSIE/) != -1) return 'Internet Explorer';
if (ua.search(/Firefox/) != -1) return 'Firefox';
if (ua.search(/Opera/) != -1) return 'Opera';
if (ua.search(/Chrome/) != -1) return 'Google Chrome';
if (ua.search(/Safari/) != -1) return 'Safari';
if (ua.search(/Konqueror/) != -1) return 'Konqueror';
if (ua.search(/Iceweasel/) != -1) return 'Debian Iceweasel';
if (ua.search(/SeaMonkey/) != -1) return 'SeaMonkey';
if (ua.search(/Gecko/) != -1) return 'Gecko';
return 'Search Bot';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment