W3C home > Mailing lists > Public > public-html@w3.org > February 2014

RE: Navigator standard change proposal

From: Travis Leithead <travis.leithead@microsoft.com>
Date: Tue, 11 Feb 2014 22:31:36 +0000
To: Predrag Stojadinović <predrag@stojadinovic.net>, "public-html@w3.org" <public-html@w3.org>
Message-ID: <7ae4332f9e8a4635ac626e1a9096d848@BLUPR03MB344.namprd03.prod.outlook.com>
Doesn’t this encourage browser detection? I’m sensitive to this topic since IE has been the target of substantial browser detection in the past, and I don’t want to encourage this kind of behavior in the future (for any browser)…

We should also keep in mind that there are other UAs besides browsers…

From: stojadinovicp@gmail.com [mailto:stojadinovicp@gmail.com] On Behalf Of Predrag Stojadinovic
Sent: Tuesday, February 11, 2014 9:06 AM
To: public-html@w3.org
Subject: Navigator standard change proposal

1. The current Navigator object standard allows for the appName attribute to be either "Netscape" or the actual name and most major browsers just settle for this default.
2. The appVersion attribute is even worse because the definition requires that attribute to either be exactly "4.0", regardless of the actual browser version, OR a detailed string, which is the option that is of course chosen, and is thus cluttered with too much data.

While, on the one hand, this additional data can be useful to some developers, the cluttering, on the other, makes it a nightmare to determine the actual browser and version which the code is being executed in.
Especially when that data changes from one version to another like we recently had in the IE10 to IE11 upgrade where IE11 all of a sudden was being detected as a special version of Firefox.

Based on the Navigator object<http://www.w3.org/TR/html5/webappapis.html#the-navigator-object> justification, which states: "This section defines a collection of attributes that can be used to determine, from script, the kind of user agent in use, in order to work around these issues." it is rather surprising that the two, usually most interesting and sought after, pieces of information must be parsed and extracted from too much cluttered text, instead of being readily available on demand.
Just to be clear, it is certainly better to use Modernizr and similar libraries to determine available features, however, it is up to the developer how they use the information obtained from the navigator object and if they create bad patterns based on the browser name and version than this really is on them. What developers do with this information is ultimately up to them, but if this is what they are actually after then it should be available.

Therefore, since the appName and appVersion have been around for a while and are what they are, instead of changing them, I propose to introduce attributes browserName and browserVersion as following:

readonly attribute DOMString browserName;
readonly attribute DOMString browserVersion;

window . navigator . browserName
    Must return the full name of the browser, e.g. "Chrome", "Firefox", "Opera", "Internet Explorer", "Safari", etc.

window . navigator . browserVersion
    Must return the full version of the browser, e.g. "32.0.1700.107", "27.0", "11.0.9600.16476", "12.11", etc.


Predrag Stojadinović
NVIDIA Europe, Software Developer

Received on Tuesday, 11 February 2014 22:32:07 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:16:37 UTC