How to Detect a Browser Using jQuery
Any developer can tell you that code will render differently depending on the browser, which can be a real hindrance to cross-browser compatibility. There are CSS hacks that can be used to determine what browser code is running on, but these can only be used to change styling, not HTML. If you want to dynamically change any HTML in your code based on the browser, you can do so using the following jQuery snippets that utilize the $.browser selector:
$(document).ready(function() { // For Chrome if ($.browser.chrome) { // insert your code here } // For Mozilla Firefox if ($.browser.mozilla & amp; & amp; $.browser.version & gt; = "1.8") { // insert your code here } // For Opera if ($.browser.opera) { // insert your code here } // For Safari if( $.browser.safari ) { // insert your code here } // For Internet Explorer versions below 6 if ($.browser.msie & amp; & amp; $.browser.version & lt; = 6) { // insert your code here } // For IE versions 6+ if ($.browser.msie & amp; & amp; $.browser.version & gt; 6) { // insert your code here } });