Monday 26 December 2011

Detect Firefox Browser using jquery

In this tutorial we'll show you JavaScript function for  Firefox  Browser detection.
 
if (jQuery.browser.mozilla) {
    // do sth.
}
 
// Select Firefox 1.5.x to 2.x
if (jQuery.browser.mozilla && jQuery.browser.version.substr(0, 3) == '1.8') {
    // do sth.
}
 
// Select Firefox under 3.x
if (jQuery.browser.mozilla && jQuery.browser.version < '1.9') {
    // do sth.
}
 
// Select Firefox 3.0.x and above
if (jQuery.browser.mozilla && jQuery.browser.version.substr(0, 3) == '1.9') {
    // do sth.
}
 
// Select just Firefox 2.0.x
if (jQuery.browser.mozilla && jQuery.browser.version == '1.8.1') {
    // do sth.
}
 
// Select just Firefox 3.0.x
if (jQuery.browser.mozilla && jQuery.browser.version == '1.9') {
    // do sth.
}
 
// Select just Firefox 3.5.x
if (jQuery.browser.mozilla && jQuery.browser.version == '1.9.1') {
    // do sth.
}
 
// Select just Firefox 3.6.x
if (jQuery.browser.mozilla && jQuery.browser.version == '1.9.2') {
    // do sth.
}
 
// Select just Firefox 7.x
if (jQuery.browser.mozilla && jQuery.browser.version.substr(0, 1) == '7') {
    // do sth.
}
 

No comments:

Post a Comment