[webkit-dev] Qt's default webkit user agent

Oliver Hunt oliver at apple.com
Tue Feb 12 02:55:45 PST 2008


You have to be careful when changing the UA as there are sites that do  
the most absurd checks.

For example including applicationVersion could easily trigger WebKit  
to be detected as another
(probably much older) browser -- i believe it is necessary to avoid  
ever having the string "4." in the
UA for example as there are used to be) sites that assume that  
indexOf("4.") != -1 means the your
browser is netscape 4 and supports the layers extension, eg. as done  
at http://www.sloppycode.net/code-snippets/javascript/web-safe-palette.aspx
(This page works unless there's a 4 in the UA version)

So at the very least i would be careful about including version info,  
you also can't remove
Mozilla/5.0, WebKit, KHTML, Gecko, or Safari because people look for  
those substrings
(Mozilla/5.0 means you're not IE -- although there's also a more  
modern version
where "Firefox" means not IE and that breaks at least one site i know  
of and use *grumble*)

All in all i'll just reiterate that changes to the UA flags are  
*dangerous* and can easily cause sites to
"break"

--Oliver

On Feb 12, 2008, at 1:38 AM, Benjamin Meyer wrote:

> As it is today Qt's default user agent (in qwebpage.cpp) is hard  
> coded to:
>
> "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/523.15  
> (KHTML,
> like Gecko) Safari/419.3 Qt"
>
> Seeing as this library will be used inside of many other  
> applications it makes
> sense to include by default at least the application name/version  
> when they
> are set.  QCoreApplication gives us several strings which can be used.
>
> applicationName, applicationVersion, organizationDomain,  
> organizationName
>
> But at a bigger question, what should be included (or not included)  
> with the
> default user agent?  Is there docs anywhere that suggest what webkit  
> library
> users should use as their user agent string?
>
> -Benjamin Meyer
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo/webkit-dev



More information about the webkit-dev mailing list