Ahsan Khurshid
Ahsan Khurshid

Reputation: 9469

$.browser.safari and $.browser.webkit shows undefined in chrome

Is it a jQuery 1.8.0 bug or a Chrome's bug that $.browser.safari and $.browser.webkit throws undefined

See Example Fiddle - JQUERY 1.8.0

See Example Fiddle - JQUERY 1.7.2

Note: I am using Chrome 21.0.1180.83 m

Upvotes: 2

Views: 4985

Answers (1)

Blender
Blender

Reputation: 298532

From the documentation, $.browser.safari is deprecated. Also, the entire $.browser object isn't even recommended for use:

Description: Contains flags for the useragent, read from navigator.userAgent. We recommend against using this property; please try to use feature detection instead (see jQuery.support). jQuery.browser may be moved to a plugin in a future release of jQuery.

Anyways, $.browser.chrome is defined for Chrome (at least for me).

Demo: http://jsfiddle.net/Pd3gf/1/

Why do you need to detect browsers in the first place? Just use $.support to see whether a browser supports a specific feature.

Upvotes: 2

Related Questions