1
2
3
4
5
6
7
// javascript: browser detection

var ie = function(){ return navigator.userAgent.indexOf('MSIE') != -1; }
var safari = function(){ return navigator.vendor != undefined && navigator.vendor.indexOf("Apple") != -1; }
var chrome = function(){ return navigator.vendor != undefined && navigator.vendor.indexOf('Google') != -1; }
var firefox = function(){ return (navigator.userAgent.indexOf('Mozilla') != -1 && navigator.vendor != undefined && navigator.vendor == ''); }
var windows = function(){ return navigator.platform == "Win32"; }