Bug 9515

Summary: Safari lies. Reports itself as Mozilla, Gecko and KHTML too.
Product: WebKit Reporter: Nicholas Shanks <nickshanks>
Component: Page LoadingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WONTFIX    
Severity: Normal    
Priority: P2    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Attachments:
Description Flags
Better User-Agent headers hyatt: review-

Nicholas Shanks
Reported 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.
Attachments
Better User-Agent headers (1.26 KB, patch)
2006-06-20 01:30 PDT, Nicholas Shanks
hyatt: review-
Nicholas Shanks
Comment 1 2006-06-20 01:30:54 PDT
Created attachment 8930 [details] Better User-Agent headers
Dave Hyatt
Comment 2 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.
Maciej Stachowiak
Comment 3 2006-06-20 01:42:18 PDT
What Dave said. Even IE claims to be Mozilla.
Nicholas Shanks
Comment 4 2006-06-20 09:26:33 PDT
Well Opera uses "Opera/9.00 (Macintosh; PPC Mac OS X; U; en)" so :-P
Geoffrey Garen
Comment 5 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.
Nicholas Shanks
Comment 6 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 :)
Alexey Proskuryakov
Comment 7 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 :)
Note You need to log in before you can comment on or make changes to this bug.