dap commit: update publication date

changeset:   287:1dab2b7c00e3
user:        Frederick Hirsch <frederick.hirsch@nokia.com>
date:        Wed Nov 28 09:11:41 2012 -0500
files:       network-api/published/20121129.html
description:
update publication date


diff -r 92a648fdcd25 -r 1dab2b7c00e3 network-api/published/20121129.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/network-api/published/20121129.html	Wed Nov 28 09:11:41 2012 -0500
@@ -0,0 +1,850 @@
+<!DOCTYPE html>
+<html lang="en" dir="ltr">
+<head>
+    <title>The Network Information API</title>
+    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+    
+    
+  <style>/*****************************************************************
+ * ReSpec 3 CSS
+ * Robin Berjon - http://berjon.com/
+ *****************************************************************/
+
+/* --- INLINES --- */
+em.rfc2119 { 
+    text-transform:     lowercase;
+    font-variant:       small-caps;
+    font-style:         normal;
+    color:              #900;
+}
+
+h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
+h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
+    border: none;
+}
+
+dfn {
+    font-weight:    bold;
+}
+
+a.internalDFN {
+    color:  inherit;
+    border-bottom:  1px solid #99c;
+    text-decoration:    none;
+}
+
+a.externalDFN {
+    color:  inherit;
+    border-bottom:  1px dotted #ccc;
+    text-decoration:    none;
+}
+
+a.bibref {
+    text-decoration:    none;
+}
+
+cite .bibref {
+    font-style: normal;
+}
+
+code {
+    color:  #ff4500;
+}
+
+
+/* --- --- */
+ol.algorithm { counter-reset:numsection; list-style-type: none; }
+ol.algorithm li { margin: 0.5em 0; }
+ol.algorithm li:before { font-weight: bold; counter-increment: numsection; content: counters(numsection, ".") ") "; }
+
+/* --- TOC --- */
+.toc a, .tof a {
+    text-decoration:    none;
+}
+
+a .secno, a .figno {
+    color:  #000;
+}
+
+ul.tof, ol.tof {
+    list-style: none outside none;
+}
+
+.caption {
+    margin-top: 0.5em;
+    font-style:   italic;
+}
+
+/* --- TABLE --- */
+table.simple {
+    border-spacing: 0;
+    border-collapse:    collapse;
+    border-bottom:  3px solid #005a9c;
+}
+
+.simple th {
+    background: #005a9c;
+    color:  #fff;
+    padding:    3px 5px;
+    text-align: left;
+}
+
+.simple th[scope="row"] {
+    background: inherit;
+    color:  inherit;
+    border-top: 1px solid #ddd;
+}
+
+.simple td {
+    padding:    3px 10px;
+    border-top: 1px solid #ddd;
+}
+
+.simple tr:nth-child(even) {
+    background: #f0f6ff;
+}
+
+/* --- DL --- */
+.section dd > p:first-child {
+    margin-top: 0;
+}
+
+.section dd > p:last-child {
+    margin-bottom: 0;
+}
+
+.section dd {
+    margin-bottom:  1em;
+}
+
+.section dl.attrs dd, .section dl.eldef dd {
+    margin-bottom:  0;
+}
+</style><style>/* --- EXAMPLES --- */
+div.example-title {
+    min-width: 7.5em;
+    color: #b9ab2d;
+}
+div.example-title span {
+    text-transform: uppercase;   
+}
+aside.example, div.example, div.illegal-example {
+    padding: 0.5em;
+    margin: 1em 0;
+    position: relative;
+    clear: both;
+}
+div.illegal-example { color: red }
+div.illegal-example p { color: black }
+aside.example, div.example {
+    padding: .5em;
+    border-left-width: .5em;
+    border-left-style: solid;
+    border-color: #e0cb52;
+    background: #fcfaee;    
+}
+
+aside.example div.example {
+    border-left-width: .1em;
+    border-color: #999;
+    background: #fff;
+}
+aside.example div.example div.example-title {
+    color: #999;
+}
+</style><style>/* --- ISSUES/NOTES --- */
+div.issue-title, div.note-title {
+    padding-right:  1em;
+    min-width: 7.5em;
+    color: #b9ab2d;
+}
+div.issue-title { color: #e05252; }
+div.note-title { color: #52e052; }
+div.issue-title span, div.note-title span {
+    text-transform: uppercase;
+}
+div.note, div.issue {
+    margin-top: 1em;
+    margin-bottom: 1em;
+}
+.note > p:first-child, .issue > p:first-child { margin-top: 0 }
+.issue, .note {
+    padding: .5em;
+    border-left-width: .5em;
+    border-left-style: solid;
+}
+div.issue, div.note {
+    padding: 0.5em;
+    margin: 1em 0;
+    position: relative;
+    clear: both;
+}
+span.note, span.issue { padding: .1em .5em .15em; }
+
+.issue {
+    border-color: #e05252;
+    background: #fbe9e9;
+}
+.note {
+    border-color: #52e052;
+    background: #e9fbe9;
+}
+
+
+</style><style>/* HIGHLIGHTS */
+code.prettyprint {
+    color:  inherit;
+}
+
+/* this from google-code-prettify */
+.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
+</style><style>/* --- WEB IDL --- */
+pre.idl {
+    border-top: 1px solid #90b8de;
+    border-bottom: 1px solid #90b8de;
+    padding:    1em;
+    line-height:    120%;
+}
+
+pre.idl::before {
+    content:    "WebIDL";
+    display:    block;
+    width:      150px;
+    background: #90b8de;
+    color:  #fff;
+    font-family:    initial;
+    padding:    3px;
+    font-weight:    bold;
+    margin: -1em 0 1em -1em;
+}
+
+.idlType {
+    color:  #ff4500;
+    font-weight:    bold;
+    text-decoration:    none;
+}
+
+/*.idlModule*/
+/*.idlModuleID*/
+/*.idlInterface*/
+.idlInterfaceID, .idlDictionaryID, .idlCallbackID, .idlEnumID {
+    font-weight:    bold;
+    color:  #005a9c;
+}
+
+.idlSuperclass {
+    font-style: italic;
+    color:  #005a9c;
+}
+
+/*.idlAttribute*/
+.idlAttrType, .idlFieldType, .idlMemberType {
+    color:  #005a9c;
+}
+.idlAttrName, .idlFieldName, .idlMemberName {
+    color:  #ff4500;
+}
+.idlAttrName a, .idlFieldName a, .idlMemberName a {
+    color:  #ff4500;
+    border-bottom:  1px dotted #ff4500;
+    text-decoration: none;
+}
+
+/*.idlMethod*/
+.idlMethType, .idlCallbackType {
+    color:  #005a9c;
+}
+.idlMethName {
+    color:  #ff4500;
+}
+.idlMethName a {
+    color:  #ff4500;
+    border-bottom:  1px dotted #ff4500;
+    text-decoration: none;
+}
+
+/*.idlParam*/
+.idlParamType {
+    color:  #005a9c;
+}
+.idlParamName {
+    font-style: italic;
+}
+
+.extAttr {
+    color:  #666;
+}
+
+/*.idlConst*/
+.idlConstType {
+    color:  #005a9c;
+}
+.idlConstName {
+    color:  #ff4500;
+}
+.idlConstName a {
+    color:  #ff4500;
+    border-bottom:  1px dotted #ff4500;
+    text-decoration: none;
+}
+
+/*.idlException*/
+.idlExceptionID {
+    font-weight:    bold;
+    color:  #c00;
+}
+
+.idlTypedefID, .idlTypedefType {
+    color:  #005a9c;
+}
+
+.idlRaises, .idlRaises a.idlType, .idlRaises a.idlType code, .excName a, .excName a code {
+    color:  #c00;
+    font-weight:    normal;
+}
+
+.excName a {
+    font-family:    monospace;
+}
+
+.idlRaises a.idlType, .excName a.idlType {
+    border-bottom:  1px dotted #c00;
+}
+
+.excGetSetTrue, .excGetSetFalse, .prmNullTrue, .prmNullFalse, .prmOptTrue, .prmOptFalse {
+    width:  45px;
+    text-align: center;
+}
+.excGetSetTrue, .prmNullTrue, .prmOptTrue { color:  #0c0; }
+.excGetSetFalse, .prmNullFalse, .prmOptFalse { color:  #c00; }
+
+.idlImplements a {
+    font-weight:    bold;
+}
+
+dl.attributes, dl.methods, dl.constants, dl.fields, dl.dictionary-members {
+    margin-left:    2em;
+}
+
+.attributes dt, .methods dt, .constants dt, .fields dt, .dictionary-members dt {
+    font-weight:    normal;
+}
+
+.attributes dt code, .methods dt code, .constants dt code, .fields dt code, .dictionary-members dt code {
+    font-weight:    bold;
+    color:  #000;
+    font-family:    monospace;
+}
+
+.attributes dt code, .fields dt code, .dictionary-members dt code {
+    background:  #ffffd2;
+}
+
+.attributes dt .idlAttrType code, .fields dt .idlFieldType code, .dictionary-members dt .idlMemberType code {
+    color:  #005a9c;
+    background:  transparent;
+    font-family:    inherit;
+    font-weight:    normal;
+    font-style: italic;
+}
+
+.methods dt code {
+    background:  #d9e6f8;
+}
+
+.constants dt code {
+    background:  #ddffd2;
+}
+
+.attributes dd, .methods dd, .constants dd, .fields dd, .dictionary-members dd {
+    margin-bottom:  1em;
+}
+
+table.parameters, table.exceptions {
+    border-spacing: 0;
+    border-collapse:    collapse;
+    margin: 0.5em 0;
+    width:  100%;
+}
+table.parameters { border-bottom:  1px solid #90b8de; }
+table.exceptions { border-bottom:  1px solid #deb890; }
+
+.parameters th, .exceptions th {
+    color:  #fff;
+    padding:    3px 5px;
+    text-align: left;
+    font-family:    initial;
+    font-weight:    normal;
+    text-shadow:    #666 1px 1px 0;
+}
+.parameters th { background: #90b8de; }
+.exceptions th { background: #deb890; }
+
+.parameters td, .exceptions td {
+    padding:    3px 10px;
+    border-top: 1px solid #ddd;
+    vertical-align: top;
+}
+
+.parameters tr:first-child td, .exceptions tr:first-child td {
+    border-top: none;
+}
+
+.parameters td.prmName, .exceptions td.excName, .exceptions td.excCodeName {
+    width:  100px;
+}
+
+.parameters td.prmType {
+    width:  120px;
+}
+
+table.exceptions table {
+    border-spacing: 0;
+    border-collapse:    collapse;
+    width:  100%;
+}
+</style><link rel="stylesheet" href="http://www.w3.org/StyleSheets/TR/W3C-WD"><!--[if lt IE 9]><script src='http://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--></head><body><div class="head">
+  <p>
+    
+      <a href="http://www.w3.org/"><img width="72" height="48" src="http://www.w3.org/Icons/w3c_home" alt="W3C"></a>
+    
+  </p>
+  <h1 class="title" id="title">The Network Information API</h1>
+  
+  <h2 id="w3c-working-draft-29-november-2012"><abbr title="World Wide Web Consortium">W3C</abbr> Working Draft 29 November 2012</h2>
+  <dl>
+    
+      <dt>This version:</dt>
+      <dd><a href="http://www.w3.org/TR/2012/WD-netinfo-api-20121129/">http://www.w3.org/TR/2012/WD-netinfo-api-20121129/</a></dd>
+      <dt>Latest published version:</dt>
+      <dd><a href="http://www.w3.org/TR/netinfo-api/">http://www.w3.org/TR/netinfo-api/</a></dd>
+    
+    
+      <dt>Latest editor's draft:</dt>
+      <dd><a href="http://dvcs.w3.org/hg/dap/raw-file/tip/network-api/Overview.html">http://dvcs.w3.org/hg/dap/raw-file/tip/network-api/Overview.html</a></dd>
+    
+    
+    
+    
+    
+      <dt>Previous version:</dt>
+      <dd><a href="http://www.w3.org/TR/2011/WD-netinfo-api-20110607/">http://www.w3.org/TR/2011/WD-netinfo-api-20110607/</a></dd>
+    
+    
+    <dt>Editor:</dt>
+    <dd><span>Mounir Lamouri</span>, <a href="http://mozilla.org/">Mozilla</a></dd>
+
+    
+  </dl>
+  
+  
+  
+  
+    
+      <p class="copyright">
+        <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 
+        2012
+        
+        <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> 
+        (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>,
+        <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>,
+        <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.
+        <abbr title="World Wide Web Consortium">W3C</abbr> <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+        <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and
+        <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.
+      </p>
+    
+  
+  <hr>
+</div>
+    <section id="abstract" class="introductory"><h2>Abstract</h2><p>
+      The Network Information API provides an interface for web applications to
+      access the underlying connection information of the device.
+    </p></section><section id="sotd" class="introductory"><h2>Status of This Document</h2>
+  
+    
+      
+        <p>
+          <em>This section describes the status of this document at the time of its publication. Other
+          documents may supersede this document. A list of current <abbr title="World Wide Web Consortium">W3C</abbr> publications and the latest revision
+          of this technical report can be found in the <a href="http://www.w3.org/TR/"><abbr title="World Wide Web Consortium">W3C</abbr> technical reports
+          index</a> at http://www.w3.org/TR/.</em>
+        </p>
+        
+      <p>
+        The functionality described in this specification was initially specified as part of the
+        <a href="http://www.w3.org/TR/system-info-api/">System Information API</a> but has been
+        extracted in order to be more readily available, more straightforward to implement, and
+        in order to produce a specification that could be implemented on its own merits without
+        interference with other, often unrelated, features.
+      </p>
+    
+        <p>
+          This document was published by the <a href="http://www.w3.org/2009/dap/">Device APIs and Policy Working Group</a> as a Working Draft.
+          
+            This document is intended to become a <abbr title="World Wide Web Consortium">W3C</abbr> Recommendation.
+          
+          If you wish to make comments regarding this document, please send them to 
+          <a href="mailto:public-device-apis@w3.org">public-device-apis@w3.org</a> 
+          (<a href="mailto:public-device-apis-request@w3.org?subject=subscribe">subscribe</a>,
+          <a href="http://lists.w3.org/Archives/Public/public-device-apis/">archives</a>).
+          
+          
+          All feedback is welcome.
+        </p>
+        
+          <p>
+            Publication as a Working Draft does not imply endorsement by the <abbr title="World Wide Web Consortium">W3C</abbr> Membership.
+            This is a draft document and may be updated, replaced or obsoleted by other documents at 
+            any time. It is inappropriate to cite this document as other than work in progress.
+          </p>
+        
+        
+        <p>
+          
+            This document was produced by a group operating under the 
+            <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>.
+          
+          
+          
+            
+              <abbr title="World Wide Web Consortium">W3C</abbr> maintains a <a href="http://www.w3.org/2004/01/pp-impl/43696/status" rel="disclosure">public list of any patent disclosures</a> 
+            
+            made in connection with the deliverables of the group; that page also includes instructions for 
+            disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains
+            <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the
+            information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
+            6 of the <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>.
+          
+          
+        </p>
+        
+      
+    
+  
+</section><section id="toc"><h2 class="introductory">Table of Contents</h2><ul class="toc"><li class="tocline"><a href="#introduction" class="tocxref"><span class="secno">1. </span>Introduction</a><ul class="toc"><li class="tocline"><a href="#use-cases" class="tocxref"><span class="secno">1.1 </span>Use Cases</a></li><li class="tocline"><a href="#outstanding-issues" class="tocxref"><span class="secno">1.2 </span>Outstanding issues</a></li></ul></li><li class="tocline"><a href="#conformance" class="tocxref"><span class="secno">2. </span>Conformance</a></li><li class="tocline"><a href="#terminology" class="tocxref"><span class="secno">3. </span>Terminology</a></li><li class="tocline"><a href="#security-and-privacy-considerations" class="tocxref"><span class="secno">4. </span>Security and privacy considerations</a></li><li class="tocline"><a href="#the-networkinformation-interface" class="tocxref"><span class="secno">5. </span>The <span class="formerLink"><code>NetworkInformation</code></span> interface</a><u class="toc"><li class="tocline"><a href="#attributes" class="tocxref"><span class="secno">5.1 </span>Attributes</a></li></ul></li><li class="tocline"><a href="#the-connection-interface" class="tocxref"><span class="secno">6. </span>The <span class="formerLink"><code>Connection</code></span> interface</a><ul class="toc"><li class="tocline"><a href="#attributes-1" class="tocxref"><span class="secno">6.1 </span>Attributes</a></li><li class="tocline"><a href="#event-handlers" class="tocxref"><span class="secno">6.2 </span>Event handlers</a></li></ul></li><li class="tocline"><a href="#examples" class="tocxref"><span class="secno">7. </span>Examples</a></li><li class="tocline"><a href="#acknowledgments" class="tocxref"><span class="secno">A. </span>Acknowledgments</a></li><li class="tocline"><a href="#references" class="tocxref"><span class="secno">B. </span>References</a><ul class="toc"><li class="tocline"><a href="#normative-references" class="tocxref"><span class="secno">B.1 </span>Normative references</a></l></ul></li></ul></section>
+
+    
+
+    <section class="informative" id="introduction">
+      <!--OddPage--><h2><span class="secno">1. </span>Introduction</h2><p><em>This section is non-normative.</em></p>
+      <p>
+        The Network Information API provides an interface enabling web applications to access the underlying
+        connection information of the device.
+      </p>
+
+      <section id="use-cases">
+        <h3><span class="secno">1.1 </span>Use Cases</h3><p><em>This section is non-normative.</em></p>
+        <p>
+          The main use case of the Network Information API is to allow
+          applications to be gentle with the user's bandwidth when they know it
+          is rare or expensive. Even if there are not many applications that do
+          this currently, this specification offers the the tools needed to
+          enable this, allowing it to become more common.
+        </p>
+        <p>
+          A few hypothetical examples would be:
+          </p><ul>
+            <li>An image viewer showing very low resolution thumbnails when the
+              user has a low bandwidth or a metered connection. 
+            </li><li>A video game loading low textures when the user has a low
+              bandwidth or a metered connection.</li>
+            <li>An email client downloading only headers or even asking the user
+              to download headers when he/she has a low bandwidth or a metered
+              connection.</li>
+            <li>Any app trying to aggressively cache any downloaded asset when
+              the user has a low bandwidth or a metered connection.</li>
+          </ul>
+        <p></p>
+      </section>
+
+      <section id="outstanding-issues">
+        <h3><span class="secno">1.2 </span>Outstanding issues</h3>
+        <p>
+          The specification currently requests the <a href="#dfn-user-agent" class="internalDFN">user agent</a> to expose
+          two properties: <code>bandwidth</code> and <code>metered</code>. The
+          working group currently does not have consensus on these.
+        </p>
+        <p>
+          One concern is that <code>bandwidth</code> may be hard to implement,
+          can be quite power-consuming to keep up-to-date and its value might be
+          unrelated to the actual connection quality that could be affected by
+          the server.<br>
+          A solution to fix this would be to return non absolute values that
+          couldn't be easily abused and would be more simple to produce for the
+          <a href="#dfn-user-agent" class="internalDFN">user agent</a>. For example, having a set of values like
+          <code>very-slow</code>, <code>slow</code>, <code>fast</code> and
+          <code>very-fast</code>. Another solution would be to have only values
+          like <code>very-slow</code>, <code>slow</code> and the empty string."
+        </p>
+        <p>
+          <code>metered</code> may also be hard to implement as there is
+          currently no standard way for the OS to know if the current connection
+          is metered.  The approach of the specification is to leave the
+          implementation details to the <a href="#dfn-user-agent" class="internalDFN">user agent</a>. That way, the
+          attribute could return a value based on a heuristic, on knowledge of
+          the current connection status or even by directly asking the user for
+          the information.<br>
+          It is interesting to point that Android 4.1 and Windows 8 both have a
+          way to check if the current connection is metered. Android is using a
+          boolean (isActiveNetworkMetered()) while Windows 8 allow the developer
+          to ask for different information (NetworkCostType,
+          ApproachingDataLimit, OverDataLimit, Roaming).
+          <!--
+            Android: https://developer.android.com/reference/android/net/ConnectivityManager.html#isActiveNetworkMetered%28%29
+            Windows: http://msdn.microsoft.com/en-us/library/windows/apps/hh465399.aspx#adapt
+          -->
+        </p>
+      </section>
+    </section>
+
+    <section id="conformance"><!--OddPage--><h2><span class="secno">2. </span>Conformance</h2>
+<p>
+  As well as sections marked as non-normative, all authoring guidelines, diagrams, examples,
+  and notes in this specification are non-normative. Everything else in this specification is
+  normative.
+</p>
+<p>
+  The key words <em class="rfc2119" title="must">must</em>, <em class="rfc2119" title="must not">must not</em>, <em class="rfc2119" title="required">required</em>, <em class="rfc2119" title="should">should</em>, <em class="rfc2119" title="should not">should not</em>, <em class="rfc2119" title="recommended">recommended</em>, <em class="rfc2119" title="may">may</em>,
+  and <em class="rfc2119" title="optional">optional</em> in this specification are to be interpreted as described in [<cite><a class="bibref" href="#bib-RFC2119">RFC2119</a></cite>].
+</p>
+
+      <p>
+        This specification defines conformance criteria that apply to a single
+        product: the <dfn id="dfn-user-agent">user agent</dfn> that implements the interfaces that
+        it contains.
+      </p>
+      <p>
+        Implementations that use ECMAScript to expose the APIs defined in this specification must implement them in a manner
+        consistent with the ECMAScript Bindings defined in the Web IDL specification [<cite><a class="bibref" href="#bib-WEBIDL">WEBIDL</a></cite>].
+      </p>
+    </section>
+
+    <section id="terminology">
+      <!--OddPage--><h2><span class="secno">3. </span>Terminology</h2>
+      <p>
+        The <code><a href="http://dev.w3.org/html5/spec/webappapis.html#function">
+        Function</a></code> interface represents a function in the scripting
+        language being used as defined in [<cite><a class="bibref" href="#bib-HTML5">HTML5</a></cite>].
+      </p>
+      <p>
+        The concepts <dfn id="dfn-queue-a-task"><a href="http://dev.w3.org/html5/spec/webappapis.html#queue-a-task">
+        queue a task</a></dfn> and
+        <dfn id="dfn-fire-a-simple-event"><a href="http://dev.w3.org/html5/spec/webappapis.html#fire-a-simple-event">
+        fire a simple event</a></dfn> are defined in [<cite><a class="bibref" href="#bib-HTML5">HTML5</a></cite>].
+      </p>
+
+      <p>
+        The terms <dfn id="dfn-event-handlers"> <a href="http://dev.w3.org/html5/spec/webappapis.html#event-handlers">
+        event handlers</a></dfn> and
+        <dfn id="dfn-event-handler-event-types"><a href="http://dev.w3.org/html5/spec/webappapis.html#event-handler-event-type">
+        event handler event types</a></dfn> are defined in [<cite><a class="bibref" href="#bib-HTML5">HTML5</a></cite>].
+      </p>
+
+      <p>
+        The concepts of <dfn id="dfn-browsing-context"><a href="http://dev.w3.org/html5/spec/browsers.html#browsing-context">
+        browsing context</a></dfn> and
+        <dfn id="dfn-active-document"><a href="http://dev.w3.org/html5/spec/browsers.html#active-document">
+        active document</a></dfn> are defined in [<cite><a class="bibref" href="#bib-HTML5">HTML5</a></cite>].
+      </p>
+
+      <p>
+        The concept of document <dfn id="dfn-domain"><a href="http://dev.w3.org/html5/spec/origin-0.html#the-document-s-domain">
+        domain</a></dfn> is defined in [<cite><a class="bibref" href="#bib-HTML5">HTML5</a></cite>].
+      </p>
+    </section>
+
+    <section id="security-and-privacy-considerations">
+      <!--OddPage--><h2><span class="secno">4. </span>Security and privacy considerations</h2>
+      <p>
+        The API defined in this specification is used to determine the connection information
+        of the hosting device. The information disclosed has minimal
+        impact on privacy or fingerprinting, and therefore is exposed without
+        permission grants. For example, authors cannot directly know what kind of connection
+        is currently in use by the hosting device.
+      </p>
+    </section>
+
+    <section id="the-networkinformation-interface">
+      <!--OddPage--><h2><span class="secno">5. </span>The <a href="#idl-def-NetworkInformation" class="idlType"><code>NetworkInformation</code></a> interface</h2>
+      <p>
+        The <a href="#idl-def-NetworkInformation" class="idlType"><code>NetworkInformation</code></a> interface is exposed on the 
+        <code>Navigator</code> object.
+      </p>
+      <pre class="idl"><span class="idlImplements"><a>Navigator</a> implements <a href="#idl-def-NetworkInformation" class="idlType"><code>NetworkInformation</code></a>;</span></pre><div class="idlImplementsDesc"><p>All instances of the <code><a>Navigator</a></code> type are defined to also implement the <a href="#idl-def-NetworkInformation" class="idlType"><code>NetworkInformation</code></a> interface.</p></div>
+      <pre class="idl"><span class="idlInterface" id="idl-def-NetworkInformation">[<span class="extAttr">NoInterfaceObject</span>]
+interface <span class="idlInterfaceID">NetworkInformation</span> {
+<span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a href="#idl-def-Connection" class="idlType"><code>Connection</code></a></span> <span class="idlAttrName"><a href="#widl-NetworkInformation-connection">connection</a></span>;</span>
+};</span></pre><section id="attributes"><h3><span class="secno">5.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-NetworkInformation-connection"><code>connection</code> of type <span class="idlAttrType"><a href="#idl-def-Connection" class="idlType"><code>Connection</code></a></span>, readonly</dt><dd>
+          The object from which connection information is accessed.
+        </dd></dl></section>
+    </section>
+
+    <section id="the-connection-interface">
+      <!--OddPage--><h2><span class="secno">6. </span>The <a href="#idl-def-Connection" class="idlType"><code>Connection</code></a> interface</h2>
+      <p>
+        The <a href="#idl-def-Connection" class="idlType"><code>Connection</code></a> interface provides a handle to the device's connection information.
+      </p>
+      <pre class="idl"><span class="idlInterface" id="idl-def-Connection">[<span class="extAttr">NoInterfaceObject</span>]
+interface <span class="idlInterfaceID">Connection</span> : <span class="idlSuperclass"><a>EventTarget</a></span> {
+<span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a>double</a></span>    <span class="idlAttrName"><a href="#widl-Connection-bandwidth">bandwidth</a></span>;</span>
+<span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a>boolean</a></span>   <span class="idlAttrName"><a href="#widl-Connection-metered">metered</a></span>;</span>
+<span class="idlAttribute">    [<span class="extAttr">TreatNonCallableAsNull</span>]
+             attribute <span class="idlAttrType"><a>Function</a>?</span> <span class="idlAttrName"><a href="#widl-Connection-onchange">onchange</a></span>;</span>
+};</span></pre><section id="attributes-1"><h3><span class="secno">6.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-Connection-bandwidth"><code>bandwidth</code> of type <span class="idlAttrType"><a>double</a></span>, readonly</dt><dd>
+          The <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> set the value of the <code>bandwidth</code> attribute to:
+          <ul>
+            <li>0 if the user is currently offline;</li>
+            <li>Infinity if the bandwidth is unknown;</li>
+            <li>an estimation of the current bandwidth in MB/s (Megabytes per seconds) available for communication with the
+                <a href="#dfn-browsing-context" class="internalDFN">browsing context</a> <a href="#dfn-active-document" class="internalDFN">active document</a>'s <a href="#dfn-domain" class="internalDFN">domain</a>.
+            </li>
+          </ul>
+        </dd><dt id="widl-Connection-metered"><code>metered</code> of type <span class="idlAttrType"><a>boolean</a></span>, readonly</dt><dd>
+          <p>
+            A connection is <dfn id="dfn-metered">metered</dfn> when the user's connection is subject to a limitation from his Internet Service Provider
+            strong enough to request web applications to be careful with the bandwidth usage.
+          </p>
+          <div class="note"><div class="note-title"><span>Note</span></div><div class="">
+            What is a metered connection is voluntarily left to the <a href="#dfn-user-agent" class="internalDFN">user agent</a> to judge. It would not be possible to give an exhaustive
+            list of limitations considered strong enough to flag the connection as metered and even if doable, some limitations can be
+            considered strong or weak depending on the context.<br>
+            Examples of metered connections are mobile connections with a small bandwidth quota or connections with a pay-per use plan.
+          </div></div>
+          <p>
+            The <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> set the value of the <code>metered</code> attribute to true if the connection with the
+            <a href="#dfn-browsing-context" class="internalDFN">browsing context</a> <a href="#dfn-active-document" class="internalDFN">active document</a>'s <a href="#dfn-domain" class="internalDFN">domain</a> is <a title="metered" href="#dfn-metered" class="internalDFN">metered</a> and false otherwise.
+            If the implementation is not able to know the status of the connection or if the user is offline, the value <em class="rfc2119" title="must">must</em> be set to false.
+          </p>
+          <div class="note"><div class="note-title"><span>Note</span></div><div class="">
+            If unable to know if a connection is metered, a <a href="#dfn-user-agent" class="internalDFN">user agent</a> could ask the user about the status of his current connection.
+            For example, a preference could let the user define if the mobile connection used on the device is metered.
+          </div></div>
+        </dd><dt id="widl-Connection-onchange"><code>onchange</code> of type <span class="idlAttrType"><a>Function</a></span>, nullable</dt><dd></dd></dl></section>
+
+      <p>
+        When the <code>Connection</code> changes, the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> <a href="#dfn-queue-a-task" class="internalDFN">queue a task</a> which updates
+        the <code>Connection</code> properties and <a href="#dfn-fire-a-simple-event" class="internalDFN">fire a simple event</a> named <code>change</code> at the
+        <code>Connection</code> object.
+      </p>
+
+      <p>
+        When the user goes online or offline, in addition to the <code>change</code> event fired on the <code>Connection</code>
+        object, the <a href="#dfn-user-agent" class="internalDFN">user agent</a> has to <a href="#dfn-fire-a-simple-event" class="internalDFN">fire a simple event</a> named either <code>online</code> or <code>offline</code>
+        depending on the applicable value, as defined in [<cite><a class="bibref" href="#bib-HTML5">HTML5</a></cite>].
+      </p>
+
+      <section id="event-handlers">
+        <h3><span class="secno">6.2 </span>Event handlers</h3>
+        <p>
+          The following are the <a href="#dfn-event-handlers" class="internalDFN">event handlers</a> (and their corresponding
+          <a href="#dfn-event-handler-event-types" class="internalDFN">event handler event types</a>) that <em class="rfc2119" title="must">must</em> be supported as
+          attributes by the <code>Connection</code> object:
+        </p>
+
+        <table class="simple">
+          <thead>
+            <tr>
+              <th>event handler</th>
+              <th>event handler event type</th>
+            </tr>
+          </thead>
+          <tbody>
+
+            <tr>
+              <td><strong><code>onchange</code></strong></td>
+              <td><code>change</code></td>
+            </tr>
+          </tbody>
+        </table>
+      </section>
+    </section>
+
+    <section class="informative" id="examples">
+      <!--OddPage--><h2><span class="secno">7. </span>Examples</h2><p><em>This section is non-normative.</em></p>
+      <p>
+        This trivial example writes the connection bandwidth to the console and shows it again each time it is changing:
+      </p>
+      <div class="example"><div class="example-title"><span>Example 1</span></div><pre class="example highlight prettyprint"><span class="kwd">function</span><span class="pln"> show</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+  console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">navigator</span><span class="pun">.</span><span class="pln">connection</span><span class="pun">.</span><span class="pln">bandwidth</span><span class="pun">);</span><span class="pln">
+</span><span class="pun">}</span><span class="pln">
+
+navigator</span><span class="pun">.</span><span class="pln">connection</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'change'</span><span class="pun">,</span><span class="pln"> show</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">);</span><span class="pln">
+
+show</span><span class="pun">();</span></pre></div>
+
+      <p>
+        This example shows how an image viewer can select a low definition or a high definition image based on the
+        current connection bandwidth:
+      </p>
+      <div class="example"><div class="example-title"><span>Example 2</span></div><pre class="example highlight prettyprint"><span class="dec">&lt;!DOCTYPE&gt;</span><span class="pln">
+</span><span class="tag">&lt;html&gt;</span><span class="pln">
+  </span><span class="tag">&lt;head&gt;</span><span class="pln">
+    </span><span class="tag">&lt;title&gt;</span><span class="pln">Pony viewer</span><span class="tag">&lt;/title&gt;</span><span class="pln">
+  </span><span class="tag">&lt;/head&gt;</span><span class="pln">
+  </span><span class="tag">&lt;body&gt;</span><span class="pln">
+    </span><span class="tag">&lt;img</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">'pony'</span><span class="pln"> </span><span class="atn">alt</span><span class="pun">=</span><span class="atv">"An image showing a pony"</span><span class="pln"> </span><span class="atn">title</span><span class="pun">=</span><span class="atv">"My precious!"</span><span class="tag">&gt;</span><span class="pln">
+    </span><span class="tag">&lt;script&gt;</span><span class="pln">
+      </span><span class="kwd">var</span><span class="pln"> i </span><span class="pun">=</span><span class="pln"> document</span><span class="pun">.</span><span class="pln">getElementById</span><span class="pun">(</span><span class="str">'pony'</span><span class="pun">);</span><span class="pln">
+
+      </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">navigator</span><span class="pun">.</span><span class="pln">connection</span><span class="pun">.</span><span class="pln">bandwidth </span><span class="pun">&gt;</span><span class="pln"> </span><span class="lit">2</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+        i</span><span class="pun">.</span><span class="pln">src </span><span class="pun">=</span><span class="pln"> </span><span class="str">"http://example.com/pony_hd.png"</span><span class="pun">;</span><span class="pln">
+      </span><span class="pun">}</span><span class="pln"> </span><span class="kwd">else</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+        i</span><span class="pun">.</span><span class="pln">src </span><span class="pun">=</span><span class="pln"> </span><span class="str">"http://example.com/pony_ld.png"</span><span class="pun">;</span><span class="pln">
+      </span><span class="pun">}</span><span class="pln">
+    </span><span class="tag">&lt;/script&gt;</span><span class="pln">
+  </span><span class="tag">&lt;/body&gt;</span><span class="pln">
+</span><span class="tag">&lt;/html&gt;</span></pre></div>
+
+      <p>
+        This example shows how an application can prevent automatic polling using the metered attribute:
+      </p>
+      <div class="example"><div class="example-title"><span>Example 3</span></div><pre class="example highlight prettyprint"><span class="dec">&lt;!DOCTYPE html&gt;</span><span class="pln">
+</span><span class="tag">&lt;html&gt;</span><span class="pln">
+  </span><span class="tag">&lt;head&gt;</span><span class="pln">
+    </span><span class="tag">&lt;title&gt;</span><span class="pln">Conditional polling</span><span class="tag">&lt;/title&gt;</span><span class="pln">
+    </span><span class="tag">&lt;script&gt;</span><span class="pln">
+      </span><span class="kwd">var</span><span class="pln"> gPreviousMetered </span><span class="pun">=</span><span class="pln"> navigator</span><span class="pun">.</span><span class="pln">connection</span><span class="pun">.</span><span class="pln">metered</span><span class="pun">;</span><span class="pln">
+      </span><span class="kwd">var</span><span class="pln"> gIntervalId</span><span class="pun">;</span><span class="pln">
+
+      </span><span class="kwd">function</span><span class="pln"> poll</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+        </span><span class="com">// poll stuff</span><span class="pln">
+      </span><span class="pun">}</span><span class="pln">
+
+      navigator</span><span class="pun">.</span><span class="pln">connection</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'change'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+        </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">gPreviousMetered </span><span class="pun">==</span><span class="pln"> navigator</span><span class="pun">.</span><span class="pln">connection</span><span class="pun">.</span><span class="pln">metered</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+          </span><span class="kwd">return</span><span class="pun">;</span><span class="pln">
+        </span><span class="pun">}</span><span class="pln">
+
+        gPreviousMetered </span><span class="pun">=</span><span class="pln"> navigator</span><span class="pun">.</span><span class="pln">connection</span><span class="pun">.</span><span class="pln">metered</span><span class="pun">;</span><span class="pln">
+        </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(!</span><span class="pln">navigator</span><span class="pun">.</span><span class="pln">connection</span><span class="pun">.</span><span class="pln">metered</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+          gIntervalId </span><span class="pun">=</span><span class="pln"> setInterval</span><span class="pun">(</span><span class="pln">poll</span><span class="pun">,</span><span class="pln"> </span><span class="lit">1000</span><span class="pun">);</span><span class="pln">
+        </span><span class="pun">}</span><span class="pln"> </span><span class="kwd">else</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+          clearInterval</span><span class="pun">(</span><span class="pln">gIntervalId</span><span class="pun">);</span><span class="pln">
+        </span><span class="pun">}</span><span class="pln">
+      </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">);</span><span class="pln">
+
+      </span><span class="com">// At load time.</span><span class="pln">
+      </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(!</span><span class="pln">navigator</span><span class="pun">.</span><span class="pln">connection</span><span class="pun">.</span><span class="pln">metered</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+        gIntervalId </span><span class="pun">=</span><span class="pln"> setInterval</span><span class="pun">(</span><span class="pln">poll</span><span class="pun">,</span><span class="pln"> </span><span class="lit">1000</span><span class="pun">);</span><span class="pln">
+      </span><span class="pun">}</span><span class="pln">
+    </span><span class="tag">&lt;/script&gt;</span><span class="pln">
+  </span><span class="tag">&lt;/head&gt;</span><span class="pln">
+  </span><span class="tag">&lt;body&gt;</span><span class="pln">
+    </span><span class="tag">&lt;button</span><span class="pln"> </span><span class="atn">onclick</span><span class="pun">=</span><span class="atv">"</span><span class="pln">poll</span><span class="pun">();</span><span class="atv">"</span><span class="tag">&gt;</span><span class="pln">Poll</span><span class="tag">&lt;/button&gt;</span><span class="pln">
+  </span><span class="tag">&lt;/body&gt;</span><span class="pln">
+</span><span class="tag">&lt;/html&gt;</span></pre></div>
+    </section>
+
+    <section class="appendix" id="acknowledgments">
+      <!--OddPage--><h2><span class="secno">A. </span>Acknowledgments</h2>
+      <p>
+        Thanks to Robin Berjon, Frederick Hirsch and Jonas Sicking for their help.
+      </p>
+    </section>
+  
+
+<section id="references" class="appendix"><!--OddPage--><h2><span class="secno">B. </span>References</h2><section id="normative-references"><h3><span class="secno">B.1 </span>Normative references</h3><dl class="bibliography"><dt id="bib-HTML5">[HTML5]</dt><dd>Ian Hickson; David Hyatt. <a href="http://www.w3.org/TR/html5"><cite>HTML5.</cite></a> 29 March 2012. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/html5">http://www.w3.org/TR/html5</a> 
+</dd><dt id="bib-RFC2119">[RFC2119]</dt><dd>S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key words for use in RFCs to Indicate Requirement Levels.</cite></a> March 1997. Internet RFC 2119.  URL: <a href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a> 
+</dd><dt id="bib-WEBIDL">[WEBIDL]</dt><dd>Cameron McCormack. <a href="http://www.w3.org/TR/2011/WD-WebIDL-20110927/"><cite>Web IDL.</cite></a> 27 September 2011. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/2011/WD-WebIDL-20110927/">http://www.w3.org/TR/2011/WD-WebIDL-20110927/</a> 
+</dd></dl></section></section></body></html>
\ No newline at end of file

Received on Wednesday, 28 November 2012 14:28:33 UTC