Reputation: 7013
I am trying to use jquery for browser detection but it says
Uncaught ReferenceError: $browser is not defined
the code is like
if(!$browser.msie){
condition
}
Upvotes: 4
Views: 12266
Reputation: 16591
browser
is a property on the main jQuery object: if(!$.browser.msie){ ... }
Please note that since the time of posting, this property has been removed in jQuery 1.9.
Upvotes: 6
Reputation: 167
$.browser was removed in jquery 1.9. See http://jquery.com/upgrade-guide/1.9/#jquery-browser-removed
Upvotes: 7
Reputation: 12633
You are missing a dot:
$.browser
Check out the documentation.
Upvotes: 2
Reputation: 140061
$browser
is not defined because the browser
property is defined as a part of the jQuery
(or $
) object.
In other words, use $.browser
or jQuery.browser
, not $browser
.
Upvotes: 5
Reputation: 18354
It's $.browser
, not $browser
if($.browser.msie) ...
Upvotes: 1