Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[] (0) Define a set of properties for browser detection.
git-svn-id: http://svn.whatwg.org/webapps@2070 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Aug 13, 2008
1 parent d6188a9 commit d931849
Show file tree
Hide file tree
Showing 2 changed files with 185 additions and 31 deletions.
123 changes: 102 additions & 21 deletions index
Expand Up @@ -1299,15 +1299,19 @@
</span>Notifications</a>
</ul>

<li><a href="#browser0"><span class=secno>5.6 </span>Browser state</a>
<li><a href="#system"><span class=secno>5.6 </span>System state and
capabilities</a>
<ul class=toc>
<li><a href="#custom-handlers"><span class=secno>5.6.1 </span>Custom
<li><a href="#client"><span class=secno>5.6.1 </span>Client
identification</a>

<li><a href="#custom-handlers"><span class=secno>5.6.2 </span>Custom
protocol and content handlers</a>
<ul class=toc>
<li><a href="#security5"><span class=secno>5.6.1.1. </span>Security
<li><a href="#security5"><span class=secno>5.6.2.1. </span>Security
and privacy</a>

<li><a href="#sample-handler-impl"><span class=secno>5.6.1.2.
<li><a href="#sample-handler-impl"><span class=secno>5.6.2.2.
</span>Sample user interface</a>
</ul>
</ul>
Expand Down Expand Up @@ -1347,7 +1351,7 @@
<li><a href="#application"><span class=secno>5.7.6 </span>Application
cache API</a>

<li><a href="#browser1"><span class=secno>5.7.7 </span>Browser
<li><a href="#browser0"><span class=secno>5.7.7 </span>Browser
state</a>
</ul>

Expand Down Expand Up @@ -31922,7 +31926,7 @@ never reset. This is nice and consistent.)
<a href="#window">Window</a> <a href="#open2" title=dom-open>open</a>(in DOMString url, in DOMString target, in DOMString features, in DOMString replace);

// the user agent
readonly attribute <a href="#clientinformation">ClientInformation</a> <a href="#navigator" title=dom-navigator>navigator</a>; <!-- XXX IE6 also has window.clientInformation pointing to this same object -->
readonly attribute <a href="#navigator0">Navigator</a> <a href="#navigator" title=dom-navigator>navigator</a>; <!-- XXX IE6 also has window.clientInformation pointing to this same object -->
readonly attribute <a href="#storage0">Storage</a> <a href="#localstorage" title=dom-localStorage>localStorage</a>;
readonly attribute <a href="#storage0">Storage</a> <a href="#sessionstorage" title=dom-sessionStorage>sessionStorage</a>;
<a href="#database0">Database</a> <a href="#opendatabase" title=dom-opendatabase>openDatabase</a>(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize);
Expand Down Expand Up @@ -33737,25 +33741,102 @@ JSURL: http://ietfreport.isoc.org/all-ids/draft-hoehrmann-javascript-scheme-00.t
brought to the user's attention, and the <var title="">onclick</var>
callback should then be invoked.

<h3 id=browser0><span class=secno>5.6 </span>Browser state</h3>
<h3 id=system><span class=secno>5.6 </span>System state and capabilities</h3>

<p>The <dfn id=navigator title=dom-navigator><code>navigator</code></dfn>
attribute of the <code><a href="#window">Window</a></code> interface must
return an instance of the <code><a
href="#clientinformation">ClientInformation</a></code> interface, which
represents the identity and state of the user agent (the client), and
allows Web pages to register themselves as potential protocol and content
handlers:

<pre
class=idl>interface <dfn id=clientinformation>ClientInformation</dfn> {
return an instance of the <code><a href="#navigator0">Navigator</a></code>
interface, which represents the identity and state of the user agent (the
client), and allows Web pages to register themselves as potential protocol
and content handlers:

<pre class=idl>interface <dfn id=navigator0>Navigator</dfn> {
// client identification<!--
readonly attribute DOMString <span title="dom-navigator-appCodeName">appCodeName</span>;-->
readonly attribute DOMString <a href="#appname" title=dom-navigator-appName>appName</a>;
readonly attribute DOMString <a href="#appversion" title=dom-navigator-appVersion>appVersion</a>;
readonly attribute DOMString <a href="#platform" title=dom-navigator-platform>platform</a>;
readonly attribute DOMString <a href="#useragent" title=dom-navigator-userAgent>userAgent</a>;

// system state
readonly attribute boolean <a href="#navigator.online" title=dom-navigator-onLine>onLine</a>;
void <a href="#registerprotocolhandler" title=dom-navigator-registerProtocolHandler>registerProtocolHandler</a>(in DOMString protocol, in DOMString url, in DOMString title);
void <a href="#registercontenthandler" title=dom-navigator-registerContentHandler>registerContentHandler</a>(in DOMString mimeType, in DOMString url, in DOMString title);
<!-- XXX there are other attributes! -->};</pre>
<!-- also, see window.external.AddSearchProvider() and similar DOM APIs from IE -->
};</pre>
<!-- XXX also, see window.external.AddSearchProvider() and similar DOM APIs from IE -->
<!-- XXX also, see: cookieEnabled geolocator javaEnabled mimeTypes mozIsLocallyAvailable plugins preference -->
<!-- XXX also, could expose languages:
<dt><dfn title="dom-navigator-browserLanguage"><code>browserLanguage</code></dfn></dt> <!- - Opera and IE only - ->
<dd><p>Must return either null or a language code representing the language the browser uses in its interface.</p></dd>
<dt><dfn title="dom-navigator-userLanguage"><code>userLanguage</code></dfn></dt> <!- - Opera and IE only - ->
<dt><dfn title="dom-navigator-language"><code>language</code></dfn></dt> <!- - Opera, Safari, and Mozilla only - ->
<dd><p>Must return either null or a language code representing the user's preferred language.</p></dd>
-->

<h4 id=client><span class=secno>5.6.1 </span>Client identification</h4>

<p>In certain cases, despite the best efforts of the entire industry, Web
browsers have bugs and limitations that Web authors are forced to work
around.

<p>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.

<p>Client detection should always be limited to detecting known current
versions; future versions and unknown versions should always be assumed to
be fully compliant.

<dl><!-- redundant
<dt><dfn title="dom-navigator-appCodeName"><code>appCodeName</code></dfn></dt>
<dd><p>Must return the string "<code title="">Mozilla</code>".</p></dd>
-->
<!-- appMinorVersion: IE only. In IE8b1, returns " Beta" (with the space) -->

<dt><dfn id=appname title=dom-navigator-appName><code>appName</code></dfn>

<dd>
<p>Must return either the string "<code title="">Netscape</code>" or the
full name of the browser, e.g. "<code title="">Mellblom
Browsernator</code>".

<dt><dfn id=appversion
title=dom-navigator-appVersion><code>appVersion</code></dfn>

<dd>
<p>Must return either the string "<code title="">4.0</code>" or a string
representing the version of the browser in detail, e.g. "<code
title="">1.0 (VMS; en-US) Mellblomenator/9000</code>".
</dd>
<!-- buildID: Mozilla only -->
<!-- oscpu: Mozilla only -->

<dt><dfn id=platform
title=dom-navigator-platform><code>platform</code></dfn>

<dd>
<p>Must return a string representing the platform on which the browser is
executing, e.g. "<code title="">MacIntel</code>", "<code
title="">Win32</code>", "<code title="">FreeBSD i386</code>", "<code
title="">WebTV OS</code>".
</dd>
<!-- product: Mozilla and Safari only; always returns "Gecko" -->
<!-- productSub: Mozilla and Safari only; returns same as buildID in Mozilla, and returns the fixed string "20030107" in Safari -->
<!-- securityPolicy: Mozilla only; always returns "" -->
<!-- taintEnabled(): Opera, IE and Mozilla have this function as one that always returns false -->

<dt><dfn id=useragent
title=dom-navigator-userAgent><code>userAgent</code></dfn>

<dd>
<p>Must return the string used for the value of the "<code
title="">User-Agent</code>" header in HTTP requests.
</dd>
<!-- vendor: Mozilla and Safari only; always returns "" in Mozilla, and returns the fixed string "Apple Computer, Inc." in Safari -->
<!-- vendorSub: Mozilla and Safari only; always returns "" -->
</dl>

<h4 id=custom-handlers><span class=secno>5.6.1 </span>Custom protocol and
<h4 id=custom-handlers><span class=secno>5.6.2 </span>Custom protocol and
content handlers</h4>

<p>The <dfn id=registerprotocolhandler
Expand Down Expand Up @@ -33902,7 +33983,7 @@ JSURL: http://ietfreport.isoc.org/all-ids/draft-hoehrmann-javascript-scheme-00.t
non-idempotent transaction), as the remote site would not be able to fetch
the same data.

<h5 id=security5><span class=secno>5.6.1.1. </span>Security and privacy</h5>
<h5 id=security5><span class=secno>5.6.2.1. </span>Security and privacy</h5>

<p>These mechanisms can introduce a number of concerns, in particular
privacy concerns.
Expand Down Expand Up @@ -33980,7 +34061,7 @@ JSURL: http://ietfreport.isoc.org/all-ids/draft-hoehrmann-javascript-scheme-00.t
trust the third-party handler, a decision many users are unable to make or
even understand).

<h5 id=sample-handler-impl><span class=secno>5.6.1.2. </span>Sample user
<h5 id=sample-handler-impl><span class=secno>5.6.2.2. </span>Sample user
interface</h5>

<p><em>This section is non-normative.</em>
Expand Down Expand Up @@ -35575,7 +35656,7 @@ style/default.css</pre>
href="#applicationcache">ApplicationCache</a></code> object.
</dl>

<h4 id=browser1><span class=secno>5.7.7 </span>Browser state</h4>
<h4 id=browser0><span class=secno>5.7.7 </span>Browser state</h4>

<p>The <dfn id=navigator.online
title=dom-navigator-onLine><code>navigator.onLine</code></dfn> attribute
Expand Down
93 changes: 83 additions & 10 deletions source
Expand Up @@ -29164,7 +29164,7 @@ never reset. This is nice and consistent.)
<span>Window</span> <span title="dom-open">open</span>(in DOMString url, in DOMString target, in DOMString features, in DOMString replace);

// the user agent
readonly attribute <span>ClientInformation</span> <span title="dom-navigator">navigator</span>; <!-- XXX IE6 also has window.clientInformation pointing to this same object -->
readonly attribute <span>Navigator</span> <span title="dom-navigator">navigator</span>; <!-- XXX IE6 also has window.clientInformation pointing to this same object -->
readonly attribute <span>Storage</span> <span title="dom-localStorage">localStorage</span>;
readonly attribute <span>Storage</span> <span title="dom-sessionStorage">sessionStorage</span>;
<span>Database</span> <span title="dom-opendatabase">openDatabase</span>(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize);
Expand Down Expand Up @@ -31069,21 +31069,94 @@ JSURL: http://ietfreport.isoc.org/all-ids/draft-hoehrmann-javascript-scheme-00.t



<h3>Browser state</h3>
<h3>System state and capabilities</h3>

<p>The <dfn title="dom-navigator"><code>navigator</code></dfn>
attribute of the <code>Window</code> interface must return an
instance of the <code>ClientInformation</code> interface, which
represents the identity and state of the user agent (the client),
and allows Web pages to register themselves as potential protocol
and content handlers:</p>

<pre class="idl">interface <dfn>ClientInformation</dfn> {
instance of the <code>Navigator</code> interface, which represents
the identity and state of the user agent (the client), and allows
Web pages to register themselves as potential protocol and content
handlers:</p>

<pre class="idl">interface <dfn>Navigator</dfn> {
// client identification<!--
readonly attribute DOMString <span title="dom-navigator-appCodeName">appCodeName</span>;-->
readonly attribute DOMString <span title="dom-navigator-appName">appName</span>;
readonly attribute DOMString <span title="dom-navigator-appVersion">appVersion</span>;
readonly attribute DOMString <span title="dom-navigator-platform">platform</span>;
readonly attribute DOMString <span title="dom-navigator-userAgent">userAgent</span>;

// system state
readonly attribute boolean <span title="dom-navigator-onLine">onLine</span>;
void <span title="dom-navigator-registerProtocolHandler">registerProtocolHandler</span>(in DOMString protocol, in DOMString url, in DOMString title);
void <span title="dom-navigator-registerContentHandler">registerContentHandler</span>(in DOMString mimeType, in DOMString url, in DOMString title);
<!-- XXX there are other attributes! -->};</pre>
<!-- also, see window.external.AddSearchProvider() and similar DOM APIs from IE -->
};</pre>

<!-- XXX also, see window.external.AddSearchProvider() and similar DOM APIs from IE -->
<!-- XXX also, see: cookieEnabled geolocator javaEnabled mimeTypes mozIsLocallyAvailable plugins preference -->

<!-- XXX also, could expose languages:
<dt><dfn title="dom-navigator-browserLanguage"><code>browserLanguage</code></dfn></dt> <!- - Opera and IE only - ->
<dd><p>Must return either null or a language code representing the language the browser uses in its interface.</p></dd>
<dt><dfn title="dom-navigator-userLanguage"><code>userLanguage</code></dfn></dt> <!- - Opera and IE only - ->
<dt><dfn title="dom-navigator-language"><code>language</code></dfn></dt> <!- - Opera, Safari, and Mozilla only - ->
<dd><p>Must return either null or a language code representing the user's preferred language.</p></dd>
-->


<h4>Client identification</h4>

<p>In certain cases, despite the best efforts of the entire
industry, Web browsers have bugs and limitations that Web authors
are forced to work around.</p>

<p>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.</p>

<p>Client detection should always be limited to detecting known
current versions; future versions and unknown versions should always
be assumed to be fully compliant.</p>

<dl>

<!-- redundant
<dt><dfn title="dom-navigator-appCodeName"><code>appCodeName</code></dfn></dt>
<dd><p>Must return the string "<code title="">Mozilla</code>".</p></dd>
-->

<!-- appMinorVersion: IE only. In IE8b1, returns " Beta" (with the space) -->

<dt><dfn title="dom-navigator-appName"><code>appName</code></dfn></dt>
<dd><p>Must return either the string "<code title="">Netscape</code>" or the full name of the browser, e.g. "<code title="">Mellblom Browsernator</code>".</p></dd>

<dt><dfn title="dom-navigator-appVersion"><code>appVersion</code></dfn></dt>
<dd><p>Must return either the string "<code title="">4.0</code>" or a string representing the version of the browser in detail, e.g. "<code title="">1.0 (VMS; en-US) Mellblomenator/9000</code>".</p></dd>

<!-- buildID: Mozilla only -->

<!-- oscpu: Mozilla only -->

<dt><dfn title="dom-navigator-platform"><code>platform</code></dfn></dt>
<dd><p>Must return a string representing the platform on which the browser is executing, e.g. "<code title="">MacIntel</code>", "<code title="">Win32</code>", "<code title="">FreeBSD i386</code>", "<code title="">WebTV OS</code>".</p></dd>

<!-- product: Mozilla and Safari only; always returns "Gecko" -->

<!-- productSub: Mozilla and Safari only; returns same as buildID in Mozilla, and returns the fixed string "20030107" in Safari -->

<!-- securityPolicy: Mozilla only; always returns "" -->

<!-- taintEnabled(): Opera, IE and Mozilla have this function as one that always returns false -->

<dt><dfn title="dom-navigator-userAgent"><code>userAgent</code></dfn></dt>
<dd><p>Must return the string used for the value of the "<code title="">User-Agent</code>" header in HTTP requests.</p></dd>

<!-- vendor: Mozilla and Safari only; always returns "" in Mozilla, and returns the fixed string "Apple Computer, Inc." in Safari -->

<!-- vendorSub: Mozilla and Safari only; always returns "" -->

</dl>


<h4 id="custom-handlers">Custom protocol and content handlers</h4>

Expand Down

0 comments on commit d931849

Please sign in to comment.