W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2008

[whatwg] Exposing UA information to workers

From: Aaron Boodman <aa@google.com>
Date: Fri, 14 Nov 2008 19:05:57 -0800
Message-ID: <278fd46c0811141905k10885aaage9ddaeba4feeceb8@mail.gmail.com>
Jonas asked me about this in IRC, and specifically why I suggested
appCodeName (since everyone claims they are Mozilla). My thinking was:

a) Browser detection is a mess, scripts use everything on the
navigator object (often incorrectly) to try and figure out which
browser is which
b) HTML5 may eventually define something better

Therefore, I could see two rational things for workers to expose: all
of whatever window.navigator has today, or whatever the new better API
is that HTML5 defines. I guess doing some subset of what
window.navigator does today could also be rational, but I don't know
how to pick the subset.

FWIW, here is the browser detection code that many Google apps use:


It uses:
- userAgent
- product
- vendor
- platform

- a

On Mon, Nov 3, 2008 at 3:59 PM, Jonas Sicking <jonas at sicking.cc> wrote:
> For future compat it would be good to expose to workers information on what
> browser is currently being used. This can be used to work around bugs and
> lack of features.
> In a 'normal' window context the navigator object exposes a set of
> properties, such as userAgent, that can be used for this purpose. I suggest
> we add something similar to the worker context. The HTML5 spec defines the
> following:
> interface Navigator {
>  // client identification
>  readonly attribute DOMString appName;
>  readonly attribute DOMString appVersion;
>  readonly attribute DOMString platform;
>  readonly attribute DOMString userAgent;
>  // ... other things not related to identifying the UA
> };
> I'm not sure how stable this part of the HTML5 spec is, (I know firefox
> exposes a whole host of more properties), but it seems like a good set to
> start with. We should probably keep the two in sync if the window context
> Navigator object changes in the future.
> Orthoginally, it seems like at least the 'onLine' boolean on the Navigator
> interface would be useful too, and could be exposed at the same place.
> Let me know what you think.
> / Jonas
Received on Friday, 14 November 2008 19:05:57 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:07 UTC