Bug 9515 - Safari lies. Reports itself as Mozilla, Gecko and KHTML too.
Summary: Safari lies. Reports itself as Mozilla, Gecko and KHTML too.
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 420+
Hardware: Macintosh OS X 10.4
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-20 01:29 PDT by Nicholas Shanks
Modified: 2006-06-20 12:57 PDT (History)
0 users

See Also:


Attachments
Better User-Agent headers (1.26 KB, patch)
2006-06-20 01:30 PDT, Nicholas Shanks
hyatt: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nicholas Shanks 2006-06-20 01:29:58 PDT
I don't think Safari should claim to be anything other than Safari. In particular, it shouldn't start with "Mozilla/". I realise that this may break the odd site here and there, but if they are browser sniffing I most likely don't want to read the contents anyway. It's time to assert conformance and good behaviour on the web by not having sloppy user agents. If you agree, apply this patch to your local builds. I don't expect it to get into ToT though.
Comment 1 Nicholas Shanks 2006-06-20 01:30:54 PDT
Created attachment 8930 [details]
Better User-Agent headers
Comment 2 Dave Hyatt 2006-06-20 01:41:00 PDT
Comment on attachment 8930 [details]
Better User-Agent headers

I belive every single browser has Mozilla/ at the start.  That is historical and is used all over the Web.  I don't think we can dump that.

We also can't dump the (KHTML, like Gecko) portion, since that breaks numerous DHTML menus and frameworks.

This isn't something we like, but it also isn't optional.  We have to work with the real world Web.
Comment 3 Maciej Stachowiak 2006-06-20 01:42:18 PDT
What Dave said. Even IE claims to be Mozilla.
Comment 4 Nicholas Shanks 2006-06-20 09:26:33 PDT
Well Opera uses "Opera/9.00 (Macintosh; PPC Mac OS X; U; en)" so :-P
Comment 5 Geoffrey Garen 2006-06-20 10:15:52 PDT
That's not entirely accurate. Opera may use "Opera" by default, but my understanding is that it masquerades as other browsers (using their exact UA strings -- much more extreme than just "Mozilla/...") on many sites that would break otherwise. 
Comment 6 Nicholas Shanks 2006-06-20 12:27:55 PDT
So, it has a hard-coded list of sites to lie to? Well I could live with something like that in Safari. Maybe even in a text file the user can edit somewhere in */Application Support/Safari/ ?

I mostly posted this for people to download and apply to their own builds, so I'm not that bothered by the review-, honestly :)
Comment 7 Alexey Proskuryakov 2006-06-20 12:57:48 PDT
To use a non-standard user agent, one can just set a Safari preference:

defaults write com.apple.Safari CustomUserAgent "MyBrowser/1.0 (NewtonOS 10.4.7; en-US-blonde)"

Disclaimer: I haven't tested this myself :)