Thursday, June 30, 2011

Seperate CSS files for Firefox versions

Have you come across UI issues in different versions of Firefox? This was the very first time for me to have version issues with Firefox. However, we can call different CSS files for different versions of firefox using jquery/javascript -

var version=jQuery.browser.version;
     if (jQuery.browser.mozilla) {  
           var verarray=version.split('.');
           if(verarray[0]=='1' && verarray[1]=='9' && verarray[2]=='2')
           {
                var head= document.getElementsByTagName('head')[0];
                var addCSS= document.createElement('link');
                addCSS.href = 'css/CSIdentity.ff3.6.css';
                addCSS.rel = 'stylesheet';
                addCSS.type = 'text/css';
                head.appendChild(addCSS);
           }   
     }