0

How can I detect if the browser is an internet explorer or firefox or chrome? Is there an easy way like just using jquery. Because I want to limit the jquery calls if my user agent is internet explorer.

Please advise.

Many thanks.

1
  • jQuery.browser has been removed from for the version version 1.9 > Commented Feb 27, 2013 at 22:23

2 Answers 2

2

jQuery.browser is deprecated in jQuery since 1.9.

There is a plugin for jQuery that adds this "back" to jquery. You will fid it (and documentation) at https://github.com/gabceb/jquery-browser-plugin

Install it by adding <script src="/path/to/jquery.browser.js"></script> after where you are adding jQuery.

then you can use the following.

$.browser.msie; //returns true if ie $.browser.webkit; //returns true if webkit-browser (Safari, Chrome) $.browser.mozilla; //returns true if firefox 
Sign up to request clarification or add additional context in comments.

Comments

0

Try jQuery.browser

Check if IE

$.browser.msie ? alert('Internet Explorer') : alert('Not Internet Explorer'); 

Or info for the browser that is accessing page

$.each($.browser, function(i, val) { $("<div>" + i + " : <span>" + val + "</span>").appendTo(document.body); }); 

Working example here

2 Comments

deprecated in new jQuery 1.9+
That's already been pointed out, also this answer if from almost two years ago.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.