Bug Tracker

Ticket #5878 (closed bug: invalid)

Opened 5 years ago

Last modified 4 years ago

Chrome on Mac reports as Safari

Reported by: oliverlangan Owned by:
Priority: minor Milestone: 1.4.1
Component: core Version: 1.4
Keywords: chrome detection Cc:
Blocking: Blocked by:

Description

On Chrome/Mac, jQuery.browser.safari returns "true"

Chrome does in fact identify itself as Safari (as well as Chrome): Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.49 Safari/532.5

Change History

comment:1 Changed 5 years ago by dmethvin

...which is why nobody should depend on jQuery.browser!

If it says it's Safari, then who are we to argue?

comment:2 Changed 4 years ago by addyosmani

  • Keywords chrome detection added
  • Status changed from new to closed
  • Resolution set to invalid

Bare in mind that we generally recommend using jQuery.support() for feature detection as opposed to userAgent sniffing using $.browser.

In addition to Dave's original comments, $.browser was deprecated for Safari as per  http://api.jquery.com/jQuery.browser/ and it is suggested you can use navigator.userAgent to check this instead if you have to (effectively the same).

Just for the sake of completeness, I've taken another look at what Chrome is outputting, and checking the userAgent string using $.browser is probably not the most reliable way of establishing whether a browser is Chrome or not.

If you absolutely *have* to, see edeiller's comment for a Chrome detection function in the comments thread here:

 http://api.jquery.com/jQuery.browser/

I'm closing this as $.browser sniffing is not something currently being recommended anymore (as far as I know).

Note: See TracTickets for help on using tickets.