It seems jQuery.browser is able to identify webkit rather easily as of 1.4. But how can I use it to distinguish Chrome from Safari (and visa-versa)?
Without jQuery
isChrome = function() {
return /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
}
isSafari = function() {
return /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor);
}
With jQuery
(Following will not work with jQuery 1.9 and above as jQuery.browser
has been removed from jQuery. See http://api.jquery.com/jQuery.browser/)
$.browser.chrome = $.browser.webkit && !!window.chrome;
$.browser.safari = $.browser.webkit && !window.chrome;