jQuery script to for browser detection

1143200 pts.
Tags:
Firefox
Internet Explorer
jquery
I'm looking to detect if our users are using Internet Explorer or Firefox but I'm having issues with the script. How can I do this using jQuery.
$(document).ready(function(e) {
    $.browser.chrome = /chrom(e|ium)/.test(navigator.userAgent.toLowerCase()); 
    if($.browser.chrome){
        alert(1);
             //this work well
    }
            else if(//the browser is IE){alert(2);}
            else if(//the browser is Firefox){alert(3);}
Can anyone help me?
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

Try this

if ($.browser.msie) {
    ....code 
    $('#test').css("margin-top","10%");
 }
 if ($.browser.webkit) {
   code goes here
 }
 if ($.browser.mozilla) {
   code goes here
 }

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: