Use jQuery To Detect What Browser Your Users Are Using

jQuery has the ability to identify what browser your users are using to visit your site.  It may be more useful to use CSS conditional comments to detect a browser, jQuery makes it very easy:


if( $.browser.safari ) {
  alert('You are using Safari');
} else if( $.browser.msie && $.browser.version > 6 ) {
  alert('You are using a modern version of Internet Explorer');
} else if( $.browser.msie && $.browser.version <= 6 ) {   alert('You really really need to upgrade your browser'); } else if( $.browser.mozilla && $.browser.version >= "1.8" ) {
  alert('You are using Firefox version greater than 1.8');
}

Leave a Reply

Your email address will not be published. Required fields are marked *