Revert the majority of commit 9e85394e6ede due to the deletion of files. Please always do 'hg pull' followed by 'hg update' before committing your own changes to this repo.
authorRich Tibbett <richt@opera.com>
Mon, 03 Sep 2012 15:35:05 +0200
changeset 215 53f4bfeee4fe
parent 214 267ff8e9346c
child 216 5583626294f6
Revert the majority of commit 9e85394e6ede due to the deletion of files. Please always do 'hg pull' followed by 'hg update' before committing your own changes to this repo.
.hgignore
battery/Overview.html
battery/tests/submissions/anssik/TODO.txt
battery/tests/submissions/anssik/battery-charging.html
battery/tests/submissions/anssik/battery-chargingchange.html
battery/tests/submissions/anssik/battery-created.html
battery/tests/submissions/anssik/battery-discharging.html
battery/tests/submissions/anssik/battery-full.html
battery/tests/submissions/anssik/battery_tests.js
battery/tests/submissions/anssik/index.html
battery/tests/submissions/anssik/manifest.txt
discovery-api/FPWD.html
discovery-api/Overview.html
discovery-api/Overview.src.html
gallery/FPWD.html
gallery/Overview.html
humidity/Overview.html
light/FPWD.html
light/Overview.html
light/tests/submissions/marcosc/DeviceLight_tests.js
light/tests/submissions/marcosc/index.html
light/tests/submissions/marcosc/manifest.txt
proximity/FPWD.html
proximity/Overview.html
proximity/tests/submissions/marcos/DeviceProximityEvent_tests.js
proximity/tests/submissions/marcos/UserProximityEvent_tests.js
proximity/tests/submissions/marcos/index.html
proximity/tests/submissions/marcos/manifest.txt
temperature/Overview.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Mon Sep 03 15:35:05 2012 +0200
@@ -0,0 +1,4 @@
+# use glob syntax.
+syntax: glob
+
+.DS_Store
--- a/battery/Overview.html	Sun Sep 02 11:11:35 2012 +0200
+++ b/battery/Overview.html	Mon Sep 03 15:35:05 2012 +0200
@@ -6,11 +6,11 @@
     <script src='http://www.w3.org/Tools/respec/respec-w3c-common' class='remove'></script>
     <script class="remove">
       var respecConfig = {
-          specStatus:           "CR",
+          specStatus:           "ED",
           shortName:            "battery-status",
-          publishDate:          "2012-05-08",
-          previousPublishDate:  "2011-11-29",
-          previousMaturity:     "LC",
+          //publishDate:          "2012-05-08",
+          previousPublishDate:  "2012-05-08",
+          previousMaturity:     "CR",
           edDraftURI:           "http://dvcs.w3.org/hg/dap/raw-file/tip/battery/Overview.html",
           // lcEnd:                "2011-12-20",
           crEnd:                "2012-07-01",
@@ -189,9 +189,9 @@
     <section>
       <h2>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 [[!HTML5]].
+        The <code><a href="http://dev.w3.org/html5/spec/webappapis.html#eventhandler">
+        EventHandler</a></code> interface represents a callback used for event
+        handlers as defined in [[!HTML5]].
       </p>
       <p>
         The concepts <dfn><a href="http://dev.w3.org/html5/spec/webappapis.html#queue-a-task">
@@ -255,22 +255,22 @@
           Represents the current battery level scaled from 0 to 1.0.
         </dd>
         <dt class="no-docs">
-          [TreatNonCallableAsNull] attribute Function? onchargingchange
+          attribute EventHandler onchargingchange
         </dt>
         <dd>
         </dd>
         <dt class="no-docs">
-          [TreatNonCallableAsNull] attribute Function? onchargingtimechange
+          attribute EventHandler onchargingtimechange
         </dt>
         <dd>
         </dd>
         <dt class="no-docs">
-          [TreatNonCallableAsNull] attribute Function? ondischargingtimechange
+          attribute EventHandler ondischargingtimechange
         </dt>
         <dd>
         </dd>
         <dt class="no-docs">
-          [TreatNonCallableAsNull] attribute Function? onlevelchange
+          attribute EventHandler onlevelchange
         </dt>
         <dd>
         </dd>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/battery/tests/submissions/anssik/TODO.txt	Mon Sep 03 15:35:05 2012 +0200
@@ -0,0 +1,5 @@
+---+ TODO
+  
+   * proper {level | chargingtime | dischargingtime}change tests
+   * async tests for *change when plugged in
+   * validate tests on a real device and tweak timeouts for async tests
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/battery/tests/submissions/anssik/battery-charging.html	Mon Sep 03 15:35:05 2012 +0200
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+  <head>
+  <title>Battery Status API Test Suite</title>
+  <script src="http://www.w3c-test.org/resources/testharness.js"></script>
+  <link rel='stylesheet' href='http://w3c-test.org/resources/testharness.css' media='all'/>
+  </head>
+  <body>
+    <h1>Description</h1>
+    <p>
+      The battery is charging.
+    </p>
+    <h2>Preconditions</h2>
+    <ol>
+      <li>
+        The device is plugged in to the charger before this test case is run.
+      </li>
+      <li>
+        The battery must neither be empty or full, nor reach empty or full capacity during the test.
+      </li>
+    </ol>
+    <div id="log"></div>
+    <script>
+    (function() {
+
+      test(function() {
+        assert_true(navigator.battery.charging);
+      }, 'The charging attribute must be set to true if the battery is charging.');
+      
+      test(function() {
+        assert_true(navigator.battery.chargingTime < Infinity);
+      }, 'The chargingTime attribute must be set to the value positive Infinity if the battery is discharging');
+      
+      test(function() {
+        assert_true(navigator.battery.dischargingTime === Infinity);
+      }, 'The dischargingTime attribute must be set to the value positive Infinity, if the battery is charging.');
+      
+      test(function() {
+        assert_true(0 < navigator.battery.level && navigator.battery.level < 1.0);
+      }, 'The level attribute must be set to the current battery level scaled from 0 to 1.0.');
+      
+    })();
+    </script>
+  </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/battery/tests/submissions/anssik/battery-chargingchange.html	Mon Sep 03 15:35:05 2012 +0200
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<html>
+  <head>
+  <title>Battery Status API Test Suite</title>
+  <script src="http://www.w3c-test.org/resources/testharness.js"></script>
+  <link rel='stylesheet' href='http://w3c-test.org/resources/testharness.css' media='all'/>
+  </head>
+  <body>
+    <h1>Description</h1>
+    <p>
+       The battery charging state is updated.
+    </p>
+    <h2>Preconditions</h2>
+    <ol>
+      <li>
+        The device is unplugged from the charger before this test case is run.
+      </li>
+      <li>
+        The battery must not be full or reach full capacity during the time the test is run.
+      </li>
+    </ol>
+    <div id="log"></div>
+    <script>
+    (function() {
+
+      // this is the pattern used for testing event handlers
+      
+      /*
+      var onclick_test = async_test('onclick on body');
+      document.querySelector('body').onclick = onclick_test.step_func(function (e) {
+        // assert_xxxx();
+        onclick_test.done();
+      });
+      
+      alert('click on body!');
+      */
+
+      // the tests below must be validated on a real implementation, to set proper timeouts etc.
+      
+      var onchargingchange_test = async_test('When the battery charging state is updated, must fire a chargingchange event.');
+      navigator.battery.onchargingchange = onchargingchange_test.step_func(function (e) {
+        assert_true(navigator.battery.charging, 'The charging attribute must be set to true, if the battery is charging.')
+        onchargingchange_test.done();
+      });
+      
+      var onchargingtimechange_test = async_test('When the battery charging time is updated, must fire a chargingtimechange event.');
+      navigator.battery.onchargingtimechange = onchargingtimechange_test.step_func(function (e) {
+        assert_false(navigator.battery.chargingTime !== Infinity);
+        onchargingchange_test.done();
+      });
+      
+      alert('Plug in the charger, and click OK.');
+
+      })();
+    </script>
+  </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/battery/tests/submissions/anssik/battery-created.html	Mon Sep 03 15:35:05 2012 +0200
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+  <head>
+  <title>Battery Status API Test Suite</title>
+  <script src="http://www.w3c-test.org/resources/testharness.js"></script>
+  <link rel='stylesheet' href='http://w3c-test.org/resources/testharness.css' media='all'/>
+  </head>
+  <body>
+    <h1>Description</h1>
+    <p>
+      <strong>
+        This test is only useful on devices that expose the BatteryManager interface,
+        but lack a backend implementation.
+      </strong>
+    </p>
+    <h2>Preconditions</h2>
+    <ol>
+      <li>
+        The implementation is unable to report the battery's charging state,
+        charging time, level or remaining time respectively.
+      </li>
+      <li>
+        The device is unplugged from the charger before this test case is run.
+      </li>
+    </ol>
+    <div id="log"></div>
+    <script>
+    (function() {
+      test(function() {
+        var b = navigator.battery;
+        assert_true(b.charging === true, 'charging must be set to true');
+        assert_true(b.chargingTime === 0, 'chargingTime must be set to 0');
+        assert_true(b.level === 1.0, 'level must be set to 1.0');
+        assert_true(b.dischargingTime === Infinity, 'dischargingTime must be set to Infinity');
+
+      }, 'When a BatteryManager object is created, charging must be set to true, ' +
+      'chargingTime to 0, level to 1.0 and dischargingTime to the value positive ' +
+      'Infinity, if the implementation is unable to report the battery\'s charging ' +
+      'state, charging time, level or remaining time respectively.');
+      })();
+    </script>
+  </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/battery/tests/submissions/anssik/battery-discharging.html	Mon Sep 03 15:35:05 2012 +0200
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+  <head>
+  <title>Battery Status API Test Suite</title>
+  <script src="http://www.w3c-test.org/resources/testharness.js"></script>
+  <link rel='stylesheet' href='http://w3c-test.org/resources/testharness.css' media='all'/>
+  </head>
+  <body>
+    <h1>Description</h1>
+    <p>
+      The battery is discharging.
+    </p>
+    <h2>Preconditions</h2>
+    <ol>
+      <li>
+        The device is unplugged from the charger before this test case is run.
+      </li>
+      <li>
+        The battery must neither be empty or full, nor reach empty or full capacity during the test.
+      </li>
+    </ol>
+    <div id="log"></div>
+    <script>
+    (function() {
+
+      test(function() {
+        assert_false(navigator.battery.charging);
+      }, 'The charging attribute must be set to false if the battery is discharging.');
+      
+      test(function() {
+        assert_true(navigator.battery.chargingTime === Infinity);
+      }, 'The chargingTime attribute must be set to the value positive Infinity if the battery is discharging');
+      
+      test(function() {
+        assert_true(navigator.battery.dischargingTime < Infinity);
+      }, 'The dischargingTime attribute must be set to the time remaining in ' +
+      'seconds until the system\'s battery is completely discharged.');
+      
+      test(function() {
+        assert_true(0 <= navigator.battery.level && navigator.battery.level <= 1.0);
+      }, 'The level attribute must be set to the current battery level scaled from 0 to 1.0');
+      
+    })();
+    </script>
+  </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/battery/tests/submissions/anssik/battery-full.html	Mon Sep 03 15:35:05 2012 +0200
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+  <head>
+  <title>Battery Status API Test Suite</title>
+  <script src="http://www.w3c-test.org/resources/testharness.js"></script>
+  <link rel='stylesheet' href='http://w3c-test.org/resources/testharness.css' media='all'/>
+  </head>
+  <body>
+    <h1>Description</h1>
+    <p>
+      The battery is full.
+    </p>
+    <h2>Preconditions</h2>
+    <ol>
+      <li>
+        The device is plugged in to the charger before this test case is run.
+      </li>
+      <li>
+        The battery is full.
+      </li>
+    </ol>
+    <div id="log"></div>
+    <script>
+    (function() {
+
+      test(function() {
+        assert_true(navigator.battery.charging);
+      }, 'The charging attribute must be set to true if the battery is charging ("or otherwise" condition).');
+      
+      test(function() {
+        assert_true(navigator.battery.chargingTime === 0);
+      }, 'The chargingTime attribute must be set to 0, if the battery is full.');
+      
+      test(function() {
+        assert_true(navigator.battery.dischargingTime === Infinity);
+      }, 'The dischargingTime attribute must be set to the value positive Infinity if the battery is charging ("or otherwise" condition).');
+      
+      test(function() {
+        assert_true(navigator.battery.level === 1.0);
+      }, 'The level attribute must be set to the current battery level scaled from 0 to 1.0.');
+      
+    })();
+    </script>
+  </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/battery/tests/submissions/anssik/battery_tests.js	Mon Sep 03 15:35:05 2012 +0200
@@ -0,0 +1,393 @@
+/**
+* W3C 3-clause BSD License
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* o Redistributions of works must retain the original copyright notice,
+*     this list of conditions and the following disclaimer.
+*
+* o Redistributions in binary form must reproduce the original copyright
+*     notice, this list of conditions and the following disclaimer in the
+*     documentation and/or other materials provided with the distribution.
+*
+* o Neither the name of the W3C nor the names of its contributors may be
+*     used to endorse or promote products derived from this work without
+*     specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+* POSSIBILITY OF SUCH DAMAGE.
+**/
+
+(function() {
+  
+  /**
+  *
+  * Navigator implements NavigatorBattery;
+  *
+  * [NoInterfaceObject]
+  * interface NavigatorBattery {
+  *    readonly attribute BatteryManager battery;
+  * };
+  *
+  */
+  
+  test(function() {
+    assert_idl_attribute(navigator, 'battery', 'navigator must have battery attribute');
+  }, 'battery is present on navigator');
+    
+  test(function() {
+    assert_readonly(navigator, 'battery', 'battery must be readonly')
+  }, 'battery is readonly');
+  
+  /**
+  *
+  * [NoInterfaceObject]
+  * interface BatteryManager : EventTarget {
+  *     readonly attribute boolean      charging;
+  *     readonly attribute double       chargingTime;
+  *     readonly attribute double       dischargingTime;
+  *     readonly attribute double       level;
+  *              attribute EventHandler onchargingchange;
+  *              attribute EventHandler onchargingtimechange;
+  *              attribute EventHandler ondischargingtimechange;
+  *              attribute EventHandler onlevelchange;
+  * };
+  *
+  */
+
+  // interface BatteryManager : EventTarget {
+  
+  test(function() {
+      assert_true(navigator.battery instanceof EventTarget);
+  }, 'battery inherits from EventTarget');
+  
+  // readonly attribute boolean charging;
+  
+  test(function() {
+    assert_idl_attribute(navigator.battery, 'charging', 'battery must have charging attribute');
+  }, 'charging attribute exists');
+  
+  test(function() {
+    assert_readonly(navigator.battery, 'charging', 'charging must be readonly')
+  }, 'charging attribute is readonly');
+
+  // readonly attribute double chargingTime;
+
+  test(function() {
+    assert_idl_attribute(navigator.battery, 'chargingTime', 'battery must have chargingTime attribute');
+  }, 'chargingTime attribute exists');
+
+  test(function() {
+    assert_readonly(navigator.battery, 'chargingTime', 'chargingTime must be readonly')
+  }, 'chargingTime attribute is readonly');
+
+  // readonly attribute double dischargingTime;
+
+  test(function() {
+    assert_idl_attribute(navigator.battery, 'dischargingTime', 'battery must have dischargingTime attribute');
+  }, 'dischargingTime attribute exists');
+
+  test(function() {
+    assert_readonly(navigator.battery, 'dischargingTime', 'dischargingTime must be readonly')
+  }, 'dischargingTime attribute is readonly');
+  
+  // readonly attribute double level;
+  
+  test(function() {
+    assert_idl_attribute(navigator.battery, 'level', 'battery must have level attribute');
+  }, 'level attribute exists');
+
+  test(function() {
+    assert_readonly(navigator.battery, 'level', 'level must be readonly')
+  }, 'level attribute is readonly');
+  
+  // attribute EventHandler onchargingchange;
+  
+  test(function() {
+    assert_idl_attribute(navigator.battery, 'onchargingchange', 'battery must have onchargingchange attribute');
+  }, 'onchargingchange attribute exists');
+  
+  test(function() {
+    assert_equals(navigator.battery.onchargingchange, null, 'onchargingchange must be null')
+  }, 'onchargingchange is null');
+  
+  test(function() {
+      var desc = 'onchargingchange did not accept callable object',
+          func = function() {},
+          desc = 'Expected to find onchargingchange attribute on battery object';
+      assert_idl_attribute(navigator.battery, 'onchargingchange', desc);
+      window.onchargingchange = func;
+      assert_equals(window.onchargingchange, func, desc);
+  }, 'onchargingchange is set to function');
+  
+  test(function() {
+      var desc = 'onchargingchange did not treat noncallable as null';
+      navigator.battery.onchargingchange = function() {};
+      navigator.battery.onchargingchange = {};
+      assert_equals(navigator.battery.onchargingchange, null, desc);
+  }, 'onchargingchange: treat object as null');
+  
+  test(function() {
+      var desc = 'onchargingchange did not treat noncallable as null';
+      navigator.battery.onchargingchange = function() {};
+      navigator.battery.onchargingchange = {
+          call: 'test'
+      };
+      assert_equals(navigator.battery.onchargingchange, null, desc);
+  }, 'onchargingchange: treat object with non-callable call property as null');
+  
+  test(function() {
+      var desc = 'onchargingchange did not treat noncallable (string) as null';
+      navigator.battery.onchargingchange = function() {};
+      navigator.battery.onchargingchange = 'string';
+      assert_equals(navigator.battery.onchargingchange, null, desc);
+  }, 'onchargingchange: treat string as null');
+
+  test(function() {
+      var desc = 'onchargingchange did not treat noncallable (number) as null';
+      navigator.battery.onchargingchange = function() {};
+      navigator.battery.onchargingchange = 123;
+      assert_equals(navigator.battery.onchargingchange, null, desc);
+  }, 'onchargingchange: treat number as null');
+
+  test(function() {
+      var desc = 'onchargingchange did not treat noncallable (undefined) as null';
+      navigator.battery.onchargingchange = function() {};
+      navigator.battery.onchargingchange = undefined;
+      assert_equals(navigator.battery.onchargingchange, null, desc);
+  }, 'onchargingchange: treat undefined as null');
+
+  test(function() {
+      var desc = 'onchargingchange did not treat noncallable (array) as null';
+      navigator.battery.onchargingchange = function() {};
+      navigator.battery.onchargingchange = [];
+      assert_equals(navigator.battery.onchargingchange, null, desc);
+  }, 'onchargingchange: treat array as null');
+
+  test(function() {
+      var desc = 'onchargingchange did not treat noncallable host object as null';
+      navigator.battery.onchargingchange = function() {};
+      navigator.battery.onchargingchange = Node;
+      assert_equals(navigator.battery.onchargingchange, null, desc);
+  }, 'onchargingchange: treat non-callable host object as null');
+  
+  // attribute EventHandler onchargingtimechange;
+  
+  test(function() {
+    assert_idl_attribute(navigator.battery, 'onchargingtimechange', 'battery must have onchargingtimechange attribute');
+  }, 'onchargingtimechange attribute exists');
+  
+  test(function() {
+    assert_equals(navigator.battery.onchargingtimechange, null, 'onchargingtimechange must be null')
+  }, 'onchargingtimechange is null');
+
+  test(function() {
+      var desc = 'onchargingtimechange did not accept callable object',
+          func = function() {},
+          desc = 'Expected to find onchargingtimechange attribute on battery object';
+      assert_idl_attribute(navigator.battery, 'onchargingtimechange', desc);
+      window.onchargingtimechange = func;
+      assert_equals(window.onchargingtimechange, func, desc);
+  }, 'onchargingtimechange is set to function');
+
+  test(function() {
+      var desc = 'onchargingtimechange did not treat noncallable as null';
+      navigator.battery.onchargingtimechange = function() {};
+      navigator.battery.onchargingtimechange = {};
+      assert_equals(navigator.battery.onchargingtimechange, null, desc);
+  }, 'onchargingtimechange: treat object as null');
+
+  test(function() {
+      var desc = 'onchargingtimechange did not treat noncallable as null';
+      navigator.battery.onchargingtimechange = function() {};
+      navigator.battery.onchargingtimechange = {
+          call: 'test'
+      };
+      assert_equals(navigator.battery.onchargingtimechange, null, desc);
+  }, 'onchargingtimechange: treat object with non-callable call property as null');
+
+  test(function() {
+      var desc = 'onchargingtimechange did not treat noncallable (string) as null';
+      navigator.battery.onchargingtimechange = function() {};
+      navigator.battery.onchargingtimechange = 'string';
+      assert_equals(navigator.battery.onchargingtimechange, null, desc);
+  }, 'onchargingtimechange: treat string as null');
+
+  test(function() {
+      var desc = 'onchargingtimechange did not treat noncallable (number) as null';
+      navigator.battery.onchargingtimechange = function() {};
+      navigator.battery.onchargingtimechange = 123;
+      assert_equals(navigator.battery.onchargingtimechange, null, desc);
+  }, 'onchargingtimechange: treat number as null');
+
+  test(function() {
+      var desc = 'onchargingtimechange did not treat noncallable (undefined) as null';
+      navigator.battery.onchargingtimechange = function() {};
+      navigator.battery.onchargingtimechange = undefined;
+      assert_equals(navigator.battery.onchargingtimechange, null, desc);
+  }, 'onchargingtimechange: treat undefined as null');
+
+  test(function() {
+      var desc = 'onchargingtimechange did not treat noncallable (array) as null';
+      navigator.battery.onchargingtimechange = function() {};
+      navigator.battery.onchargingtimechange = [];
+      assert_equals(navigator.battery.onchargingtimechange, null, desc);
+  }, 'onchargingtimechange: treat array as null');
+
+  test(function() {
+      var desc = 'onchargingtimechange did not treat noncallable host object as null';
+      navigator.battery.onchargingtimechange = function() {};
+      navigator.battery.onchargingtimechange = Node;
+      assert_equals(navigator.battery.onchargingtimechange, null, desc);
+  }, 'onchargingtimechange: treat non-callable host object as null');
+    
+  // attribute EventHandler ondischargingtimechange;
+  
+  test(function() {
+    assert_idl_attribute(navigator.battery, 'ondischargingtimechange', 'battery must have ondischargingtimechange attribute');
+  }, 'ondischargingtimechange attribute exists');
+
+  test(function() {
+    assert_equals(navigator.battery.ondischargingtimechange, null, 'ondischargingtimechange must be null')
+  }, 'ondischargingtimechange is null');
+  
+  test(function() {
+      var desc = 'ondischargingtimechange did not accept callable object',
+          func = function() {},
+          desc = 'Expected to find ondischargingtimechange attribute on battery object';
+      assert_idl_attribute(navigator.battery, 'ondischargingtimechange', desc);
+      window.ondischargingtimechange = func;
+      assert_equals(window.ondischargingtimechange, func, desc);
+  }, 'ondischargingtimechange is set to function');
+
+  test(function() {
+      var desc = 'ondischargingtimechange did not treat noncallable as null';
+      navigator.battery.ondischargingtimechange = function() {};
+      navigator.battery.ondischargingtimechange = {};
+      assert_equals(navigator.battery.ondischargingtimechange, null, desc);
+  }, 'ondischargingtimechange: treat object as null');
+
+  test(function() {
+      var desc = 'ondischargingtimechange did not treat noncallable as null';
+      navigator.battery.ondischargingtimechange = function() {};
+      navigator.battery.ondischargingtimechange = {
+          call: 'test'
+      };
+      assert_equals(navigator.battery.ondischargingtimechange, null, desc);
+  }, 'ondischargingtimechange: treat object with non-callable call property as null');
+
+  test(function() {
+      var desc = 'ondischargingtimechange did not treat noncallable (string) as null';
+      navigator.battery.ondischargingtimechange = function() {};
+      navigator.battery.ondischargingtimechange = 'string';
+      assert_equals(navigator.battery.ondischargingtimechange, null, desc);
+  }, 'ondischargingtimechange: treat string as null');
+
+  test(function() {
+      var desc = 'ondischargingtimechange did not treat noncallable (number) as null';
+      navigator.battery.ondischargingtimechange = function() {};
+      navigator.battery.ondischargingtimechange = 123;
+      assert_equals(navigator.battery.ondischargingtimechange, null, desc);
+  }, 'ondischargingtimechange: treat number as null');
+
+  test(function() {
+      var desc = 'ondischargingtimechange did not treat noncallable (undefined) as null';
+      navigator.battery.ondischargingtimechange = function() {};
+      navigator.battery.ondischargingtimechange = undefined;
+      assert_equals(navigator.battery.ondischargingtimechange, null, desc);
+  }, 'ondischargingtimechange: treat undefined as null');
+
+  test(function() {
+      var desc = 'ondischargingtimechange did not treat noncallable (array) as null';
+      navigator.battery.ondischargingtimechange = function() {};
+      navigator.battery.ondischargingtimechange = [];
+      assert_equals(navigator.battery.ondischargingtimechange, null, desc);
+  }, 'ondischargingtimechange: treat array as null');
+
+  test(function() {
+      var desc = 'ondischargingtimechange did not treat noncallable host object as null';
+      navigator.battery.ondischargingtimechange = function() {};
+      navigator.battery.ondischargingtimechange = Node;
+      assert_equals(navigator.battery.ondischargingtimechange, null, desc);
+  }, 'ondischargingtimechange: treat non-callable host object as null');
+
+  // attribute EventHandler onlevelchange;
+
+  test(function() {
+    assert_idl_attribute(navigator.battery, 'onlevelchange', 'battery must have onlevelchange attribute');
+  }, 'onlevelchange attribute exists');
+  
+  test(function() {
+    assert_equals(navigator.battery.onlevelchange, null, 'onlevelchange must be null')
+  }, 'onlevelchange is null');
+  
+  test(function() {
+      var desc = 'onlevelchange did not accept callable object',
+          func = function() {},
+          desc = 'Expected to find onlevelchange attribute on battery object';
+      assert_idl_attribute(navigator.battery, 'onlevelchange', desc);
+      window.onlevelchange = func;
+      assert_equals(window.onlevelchange, func, desc);
+  }, 'onlevelchange is set to function');
+
+  test(function() {
+      var desc = 'onlevelchange did not treat noncallable as null';
+      navigator.battery.onlevelchange = function() {};
+      navigator.battery.onlevelchange = {};
+      assert_equals(navigator.battery.onlevelchange, null, desc);
+  }, 'onlevelchange: treat object as null');
+
+  test(function() {
+      var desc = 'onlevelchange did not treat noncallable as null';
+      navigator.battery.onlevelchange = function() {};
+      navigator.battery.onlevelchange = {
+          call: 'test'
+      };
+      assert_equals(navigator.battery.onlevelchange, null, desc);
+  }, 'onlevelchange: treat object with non-callable call property as null');
+
+  test(function() {
+      var desc = 'onlevelchange did not treat noncallable (string) as null';
+      navigator.battery.onlevelchange = function() {};
+      navigator.battery.onlevelchange = 'string';
+      assert_equals(navigator.battery.onlevelchange, null, desc);
+  }, 'onlevelchange: treat string as null');
+
+  test(function() {
+      var desc = 'onlevelchange did not treat noncallable (number) as null';
+      navigator.battery.onlevelchange = function() {};
+      navigator.battery.onlevelchange = 123;
+      assert_equals(navigator.battery.onlevelchange, null, desc);
+  }, 'onlevelchange: treat number as null');
+
+  test(function() {
+      var desc = 'onlevelchange did not treat noncallable (undefined) as null';
+      navigator.battery.onlevelchange = function() {};
+      navigator.battery.onlevelchange = undefined;
+      assert_equals(navigator.battery.onlevelchange, null, desc);
+  }, 'onlevelchange: treat undefined as null');
+
+  test(function() {
+      var desc = 'onlevelchange did not treat noncallable (array) as null';
+      navigator.battery.onlevelchange = function() {};
+      navigator.battery.onlevelchange = [];
+      assert_equals(navigator.battery.onlevelchange, null, desc);
+  }, 'onlevelchange: treat array as null');
+
+  test(function() {
+      var desc = 'onlevelchange did not treat noncallable host object as null';
+      navigator.battery.onlevelchange = function() {};
+      navigator.battery.onlevelchange = Node;
+      assert_equals(navigator.battery.onlevelchange, null, desc);
+  }, 'onlevelchange: treat non-callable host object as null');
+  
+})();
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/battery/tests/submissions/anssik/index.html	Mon Sep 03 15:35:05 2012 +0200
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Battery Status API Test Suite</title>
+<script src="http://www.w3c-test.org/resources/testharness.js"></script>
+<script src="battery_tests.js"></script>
+</head>
+<body>
+<h1>Test Suite for Battery Status API (Work in Progress)</h1>
+<div id="log"></div>
+<p>
+  <small>
+    Distributed under both the
+    <a href="http://www.w3.org/Consortium/Legal/2008/04-testsuite-license">
+    W3C Test Suite License</a> and the
+    <a href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license">
+    W3C 3-clause BSD License</a>. To contribute to a W3C Test Suite, see the
+    <a href="http://www.w3.org/2004/10/27-testcases">policies and contribution
+    forms</a>.
+  </small>
+</p>
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/battery/tests/submissions/anssik/manifest.txt	Mon Sep 03 15:35:05 2012 +0200
@@ -0,0 +1,6 @@
+index.html		Battery Status API Test Suite					
+battery-charging.html		Battery Status API Test Suite					
+battery-chargingchange.html		Battery Status API Test Suite					
+battery-created.html		Battery Status API Test Suite					
+battery-discharging.html		Battery Status API Test Suite					
+battery-full.html		Battery Status API Test Suite					
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/discovery-api/FPWD.html	Mon Sep 03 15:35:05 2012 +0200
@@ -0,0 +1,1797 @@
+<!DOCTYPE html>
+<html lang="en" dir="ltr">
+<head>
+    <title>Networked Service Discovery and Messaging</title>
+    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+    
+
+    
+    <style type="text/css">
+      /* Custom CSS optimizations (Richard Tibbett) */
+
+      /* Add better spacing to sections */
+      section, .section { margin-bottom: 2em; }
+
+      /* Reduce note & issue render size */
+      .note, .issue { font-size:0.8em; }
+
+      /* Add addition spacing to <ol> and <ul> for rule definition */
+      ol.rule li, ul.rule li { padding:0.6em; }
+
+      pre.widl { border: solid thin; background: #EEEEEE; color: black; padding: 0.5em 1em; position: relative; }
+      pre.widl :link, pre.widl :visited { color: #000; background: transparent; }
+      pre.widl:before { content: "IDL"; font: bold small sans-serif; padding: 0.5em; background: white; position: absolute; top: 0; margin: -1px 0 0 -4em; width: 1.5em; border: thin solid; border-radius: 0 0 0 0.5em }
+
+      div.example { border: solid thin red; background: #F7DFE5; color: black; padding: 0.5em 1em; position: relative; margin: 1em 0 1em 4.6em; width: auto; }
+      div.example:before { content: "EXAMPLE"; font: bold small sans-serif; padding: 0.5em; background: red; color: white; position: absolute; top: 0; margin: -1px 0 0 -7.6em; width: 5em; border: thin solid red; border-radius: 0 0 0 0.5em }
+
+      dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
+      hr + dl.domintro, div.impl + dl.domintro { margin-top: 2.5em; margin-bottom: 1.5em; }
+      dl.domintro dt, dl.domintro dt * { color: black; text-decoration: none; }
+      dl.domintro dd { margin: 0.5em 0 1em 2em; padding: 0; }
+      dl.domintro dd p { margin: 0.5em 0; }
+      dl.domintro code {font-size: inherit; font-style: italic; }
+      dl.domintro:before { display: table; margin: -1em -0.5em 0.5em auto; width: auto; content: 'This box is non-normative. Implementation requirements are given below this box.'; color: red; border: solid 2px; background: white; padding: 0 0.25em; }
+    </style>
+  <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>/* --- 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><link href="http://www.w3.org/StyleSheets/TR/W3C-WD" rel="stylesheet"><!--[if lt IE 9]><script src='undefined://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--></head>
+
+  <body><div class="head">
+  <p>
+    
+      <a href="http://www.w3.org/"><img src="http://www.w3.org/Icons/w3c_home" alt="W3C" height="48" width="72"></a>
+    
+  </p>
+  <h1 class="title" id="title">Networked Service Discovery and Messaging</h1>
+  
+  <h2 id="w3c-working-draft-07-august-2012"><abbr title="World Wide Web Consortium">W3C</abbr> Working Draft 07 August 2012</h2>
+  <dl>
+    
+      <dt>This version:</dt>
+      <dd><a href="http://www.w3.org/TR/2012/WD-discovery-api-20120807/">http://www.w3.org/TR/2012/WD-discovery-api-20120807/</a></dd>
+      <dt>Latest published version:</dt>
+      <dd><a href="http://www.w3.org/TR/discovery-api/">http://www.w3.org/TR/discovery-api/</a></dd>
+    
+    
+      <dt>Latest editor's draft:</dt>
+      <dd><a href="http://w3c-test.org/dap/discovery-api/">http://w3c-test.org/dap/discovery-api/</a></dd>
+    
+    
+    
+    
+    
+    
+    <dt>Editors:</dt>
+    <dd><span>Rich Tibbett</span>, <a href="http://opera.com/">Opera Software ASA</a></dd>
+<dd><span>Clarke Stevens</span>, <a href="http://cablelabs.com/">CableLabs</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 class="introductory" id="abstract"><h2>Abstract</h2>
+      <p>
+        This specification defines a mechanism for an HTML document to discover and subsequently communicate with <abbr title="Hypertext Transfer Protocol">HTTP</abbr>-based services
+        advertised via common discovery protocols within a user's network.
+      </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>
+        This document represents the early consensus of the group on the scope and features of the proposed
+        <abbr title="Application Programming Interface">API</abbr>.
+      </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 First Public 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 class="tocxref" href="#introduction"><span class="secno">1. </span>Introduction</a></li><li class="tocline"><a class="tocxref" href="#conformance"><span class="secno">2. </span>Conformance</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#dependencies"><span class="secno">2.1 </span>Dependencies</a></li></ul></li><li class="tocline"><a class="tocxref" href="#terminology"><span class="secno">3. </span>Terminology</a></li><li class="tocline"><a class="tocxref" href="#requesting-networked-services"><span class="secno">4. </span>Requesting networked services</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#methods"><span class="secno">4.1 </span>Methods</a></li><li class="tocline"><a class="tocxref" href="#error-handling"><span class="secno">4.2 </span>Error Handling</a></li></ul></li><li class="tocline"><a class="tocxref" href="#obtaining-networked-services"><span class="secno">5. </span>Obtaining networked services</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#attributes"><span class="secno">5.1 </span>Attributes</a></li><li class="tocline"><a class="tocxref" href="#methods-1"><span class="secno">5.2 </span>Methods</a></li><li class="tocline"><a class="tocxref" href="#events"><span class="secno">5.3 </span>Events</a></li></ul></li><li class="tocline"><a class="tocxref" href="#communicating-with-a-networked-service"><span class="secno">6. </span>Communicating with a networked service</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#attributes-1"><span class="secno">6.1 </span>Attributes</a></li><li class="tocline"><a class="tocxref" href="#states"><span class="secno">6.2 </span>States</a></li><li class="tocline"><a class="tocxref" href="#events-1"><span class="secno">6.3 </span>Events</a></li></ul></li><li class="tocline"><a class="tocxref" href="#service-discovery"><span class="secno">7. </span>Service Discovery</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#zeroconf-mdns-dns-sd"><span class="secno">7.1 </span>Zeroconf (<abbr title="Multicast DNS">mDNS</abbr> + <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr>)</a></li><li class="tocline"><a class="tocxref" href="#universal-plug-and-play-upnp"><span class="secno">7.2 </span>Universal Plug-and-Play (<abbr title="Universal Plug-and-Play">UPnP</abbr>)</a></li><li class="tocline"><a class="tocxref" href="#network-topology-monitoring"><span class="secno">7.3 </span>Network Topology Monitoring</a></li></ul></li><li class="tocline"><a class="tocxref" href="#garbage-collection"><span class="secno">8. </span>Garbage collection</a></li><li class="tocline"><a class="tocxref" href="#use-cases-and-requirements"><span class="secno">9. </span>Use Cases and Requirements</a></li><li class="tocline"><a class="tocxref" href="#examples"><span class="secno">A. </span>Examples</a></li><li class="tocline"><a class="tocxref" href="#acknowledgements"><span class="secno">B. </span>Acknowledgements</a></li><li class="tocline"><a class="tocxref" href="#references"><span class="secno">C. </span>References</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#normative-references"><span class="secno">C.1 </span>Normative references</a></li><li class="tocline"><a class="tocxref" href="#informative-references"><span class="secno">C.2 </span>Informative references</a></li></ul></li></ul></section>
+
+    
+
+    <section id="introduction" class="informative">
+      <!--OddPage--><h2><span class="secno">1. </span>Introduction</h2><p><em>This section is non-normative.</em></p>
+
+      <p>To enable Web pages to connect and communicate with Local-networked Services provided over <abbr title="Hypertext Transfer Protocol">HTTP</abbr>, this specification introduces the
+      <a href="#navigatornetworkservice"><code>NavigatorNetworkService</code></a> interface.</p>
+
+      <p>
+         Using this <abbr title="Application Programming Interface">API</abbr> consists of requesting a well-known service type, known by developers and advertised by Local-networked Devices. User authorization, where the user connects the web page to one or more discovered services,
+         is expected before the web page is able to interact with any Local-networked Services.
+      </p>
+
+      <p>
+         A web page creates a request to obtain connectivity to services running in the network by specifying a well-known discovery service type that it wishes to interact with.
+      </p>
+
+      <p>
+         The user agent, having captured all advertised services on the network from the Service Discovery mechanisms included in this recommendation, attempts to match
+      the requested service type to a discovered service according to the processing described herein.
+      </p>
+
+      <p>
+          If a service connectivity request is successful then the Web page is provided with the necessary information to communicate with the authorized Local-networked Service.
+          If the request fails then the Web page will receive an error callback containing an error code describing the cause of Local-networked Service connectivity failure.
+      </p>
+
+      <p>
+         Once connected to a Local-networked Service the Web page can send requests and receive responses to the Local-networked Service via the messaging format and appropriate channel inferred from the service type
+         authorized via the provided <abbr title="Application Programming Interface">API</abbr>.
+         The Web page, once connected, can also receive service-pushed events, in the messaging format supported by the Local-networked Device, if such event subscription functionality is provided by the
+         connected Local-networked Service.
+      </p>
+
+      <div class="example">
+       <p>Example of requesting a <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr> advertised service:</p>
+       <hr>
+       <pre class="highlight prettyprint"><span class="kwd">function</span><span class="pln"> showServices</span><span class="pun">(</span><span class="pln"> services </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+  </span><span class="com">// Show a list of all the services provided to the web page</span><span class="pln">
+  </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class="pln"> i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> l </span><span class="pun">=</span><span class="pln"> services</span><span class="pun">.</span><span class="pln">length</span><span class="pun">;</span><span class="pln"> i </span><span class="pun">&lt;</span><span class="pln"> l</span><span class="pun">;</span><span class="pln"> i</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"> services</span><span class="pun">[</span><span class="pln">i</span><span class="pun">].</span><span class="pln">name </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">getNetworkServices</span><span class="pun">(</span><span class="str">'zeroconf:_boxee-jsonrpc._tcp'</span><span class="pun">,</span><span class="pln"> showServices</span><span class="pun">);</span></pre>
+      </div>
+
+      <div class="example">
+        <p>Example of requesting a <abbr title="Universal Plug-and-Play">UPnP</abbr> advertised service, also handling error conditions:</p>
+        <hr>
+        <pre class="highlight prettyprint"><span class="kwd">function</span><span class="pln"> showServices</span><span class="pun">(</span><span class="pln"> services </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+  </span><span class="com">// Show a list of all the services provided to the web page</span><span class="pln">
+  </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class="pln"> i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> l </span><span class="pun">=</span><span class="pln"> services</span><span class="pun">.</span><span class="pln">length</span><span class="pun">;</span><span class="pln"> i </span><span class="pun">&lt;</span><span class="pln"> l</span><span class="pun">;</span><span class="pln"> i</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"> services</span><span class="pun">[</span><span class="pln">i</span><span class="pun">].</span><span class="pln">name </span><span class="pun">);</span><span class="pln">
+</span><span class="pun">}</span><span class="pln">
+
+</span><span class="kwd">function</span><span class="pln"> error</span><span class="pun">(</span><span class="pln"> e </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"> </span><span class="str">"Error occurred: "</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> e</span><span class="pun">.</span><span class="pln">code </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">getNetworkServices</span><span class="pun">(</span><span class="str">'upnp:urn:schemas-upnp-org:service:ContentDirectory:1'</span><span class="pun">,</span><span class="pln"> showServices</span><span class="pun">,</span><span class="pln"> error</span><span class="pun">);</span></pre>
+      </div>
+
+      <div class="example">
+        <p>Example of requesting either a <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr> or <abbr title="Universal Plug-and-Play">UPnP</abbr> advertised service:</p>
+        <hr>
+        <pre class="highlight prettyprint"><span class="kwd">function</span><span class="pln"> showServices</span><span class="pun">(</span><span class="pln"> services </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+  </span><span class="com">// Show a list of all the services provided to the web page (+ service type)</span><span class="pln">
+  </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class="pln"> i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> l </span><span class="pun">=</span><span class="pln"> services</span><span class="pun">.</span><span class="pln">length</span><span class="pun">;</span><span class="pln"> i </span><span class="pun">&lt;</span><span class="pln"> l</span><span class="pun">;</span><span class="pln"> i</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"> services</span><span class="pun">[</span><span class="pln">i</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">'('</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="pln">i</span><span class="pun">].</span><span class="pln">type </span><span class="pun">+</span><span class="pln"> </span><span class="str">')'</span><span class="pln"> </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">getNetworkServices</span><span class="pun">([</span><span class="pln">
+  </span><span class="str">'zeroconf:_boxee-jsonrpc._tcp'</span><span class="pun">,</span><span class="pln">
+  </span><span class="str">'upnp:urn:schemas-upnp-org:service:ContentDirectory:1'</span><span class="pln">
+</span><span class="pun">],</span><span class="pln"> showServices</span><span class="pun">);</span></pre>
+      </div>
+
+      <p>For more detailed examples see the <a href="#examples">Examples</a> section.
+    </p></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 title="must" class="rfc2119">must</em>, <em title="must not" class="rfc2119">must not</em>, <em title="required" class="rfc2119">required</em>, <em title="should" class="rfc2119">should</em>, <em title="should not" class="rfc2119">should not</em>, <em title="recommended" class="rfc2119">recommended</em>, <em title="may" class="rfc2119">may</em>,
+  and <em title="optional" class="rfc2119">optional</em> in this specification are to be interpreted as described in [<cite><a href="#bib-RFC2119" class="bibref">RFC2119</a></cite>].
+</p>
+
+
+     <p>Requirements phrased in the imperative as part of algorithms (such as "strip any leading space characters" or "return false and abort these steps") are to be interpreted with the
+     meaning of the key word ("must", "should", "may", etc) used in introducing the algorithm.</p>
+
+     <p>
+      Some conformance requirements are phrased as requirements on attributes, methods or objects. Such requirements are to be interpreted as requirements on user agents.
+     </p>
+
+     <p>
+      Conformance requirements phrased as algorithms or specific steps may be implemented in any manner, so long as the end result is equivalent. (In particular, the algorithms defined in
+      this specification are intended to be easy to follow, and not intended to be performant.)
+     </p>
+
+     <p>
+      The only conformance class defined by this specification is a <dfn id="dfn-user-agent">user agent</dfn>.
+     </p>
+
+     <p>
+      User agents may impose implementation-specific limits on otherwise unconstrained inputs, e.g. to prevent denial of service attacks, to guard against running out of memory, or to work
+      around platform-specific limitations.
+     </p>
+
+     <p>
+      When support for a feature is disabled (e.g. as an emergency measure to mitigate a security problem, or to aid in development, or for performance reasons), user agents must act as if
+      they had no support for the feature whatsoever, and as if the feature was not mentioned in this specification. For example, if a particular feature is accessed via an attribute in a Web
+      IDL interface, the attribute itself would be omitted from the objects that implement that interface - leaving the attribute on the object but making it return null or throw an exception
+      is insufficient.
+     </p>
+
+      <section id="dependencies">
+         <h3><span class="secno">2.1 </span>Dependencies</h3>
+
+         This specification relies on several other underlying specifications.
+
+         <dl>
+            <dt>HTML</dt>
+            <dd>Many fundamental concepts from HTML are used by this specification. [<cite><a href="#bib-HTML5" class="bibref">HTML5</a></cite>]</dd>
+            <dt>WebIDL</dt>
+            <dd>The IDL blocks in this specification use the semantics of the WebIDL specification. [<cite><a href="#bib-WEBIDL" class="bibref">WEBIDL</a></cite>]</dd>
+         </dl>
+      </section>
+    </section>
+
+    <section id="terminology">
+      <!--OddPage--><h2><span class="secno">3. </span>Terminology</h2>
+
+      <p>
+         The construction "a <code>Foo</code> object", where <code>Foo</code> is actually an interface, is sometimes used instead of the more accurate "an object implementing the interface <code>Foo</code>".
+      </p>
+
+      <p>
+         The term DOM is used to refer to the <abbr title="Application Programming Interface">API</abbr> set made available to scripts in Web applications, and does not necessarily imply the existence of an actual <code>Document</code> object or of any
+         other <code>Node</code> objects as defined in the DOM Core specifications. [<cite><a href="#bib-DOM4" class="bibref">DOM4</a></cite>]
+      </p>
+
+      <p>
+         An IDL attribute is said to be <em>getting</em> when its value is being retrieved (e.g. by author script), and is said to be <em>setting</em> when a new value is assigned to it.
+      </p>
+
+      <p>
+        A <dfn id="dfn-valid-service-type">valid service type</dfn> is a string that begins with <code>upnp:</code> or <code>zeroconf:</code> followed by one or more characters in the ranges U+0021, U+0023 to U+0027, U+002A to U+002B, U+002D to U+002E, U+0030 to U+0039, U+0041 to U+005A, U+005E to U+007E.
+      </p>
+
+      <p>
+        A <a class="internalDFN" href="#dfn-valid-service-type">valid service type</a> provided in the <code>type</code> attribute of the <code>getNetworkServices()</code> method will be matched against the services currently contained in the <a class="internalDFN" href="#dfn-list-of-available-service-records">list of available service records</a> according to the algorithms defined in this specification.
+      </p>
+    </section>
+
+    <section id="requesting-networked-services">
+     <!--OddPage--><h2><span class="secno">4. </span>Requesting networked services</h2>
+
+
+<pre class="widl">[Supplemental, NoInterfaceObject]
+interface <dfn id="navigatornetworkservice">NavigatorNetworkService</dfn> {
+  // Obtain a Local-networked Service
+  void <a href="#dom-navigator-getnetworkservices">getNetworkServices</a>( in any type,
+                           in <a href="#navigatornetworkservicesuccesscallback">NavigatorNetworkServiceSuccessCallback</a> successCallback,
+                           in optional <a href="#navigatornetworkserviceerrorcallback">NavigatorNetworkServiceErrorCallback</a> errorCallback );
+};
+<a class="externalDFN" href="http://www.whatwg.org/specs/web-apps/current-work/complete/timers.html#navigator">Navigator</a> implements <a href="#navigatornetworkservice">NavigatorNetworkService</a>;
+
+[Callback=FunctionOnly, NoInterfaceObject]
+interface <dfn id="navigatornetworkservicesuccesscallback">NavigatorNetworkServiceSuccessCallback</dfn> {
+  void handleEvent( in <a href="#networkservices">NetworkServices</a> services );
+};
+
+[NoInterfaceObject]
+interface <dfn id="navigatornetworkserviceerror">NavigatorNetworkServiceError</dfn> {
+  const unsigned short <a href="#dom-navigatornetworkserviceerror-permission_denied">PERMISSION_DENIED_ERR</a> = 1;
+  const unsigned short <a href="#dom-navigatornetworkserviceerror-unknown_type_prefix">UNKNOWN_TYPE_PREFIX_ERR</a> = 2;
+  readonly attribute unsigned short <a href="#dom-navigatornetworkserviceerror-code">code</a>;
+};
+
+[Callback=FunctionOnly, NoInterfaceObject]
+interface <dfn id="navigatornetworkserviceerrorcallback">NavigatorNetworkServiceErrorCallback</dfn> {
+  void handleEvent( in <a href="#navigatornetworkserviceerror">NavigatorNetworkServiceError</a> error );
+};
+</pre>
+
+  <section id="methods">
+   <h3><span class="secno">4.1 </span>Methods</h3>
+
+      <dl class="domintro">
+        <dt>
+          <var title="">window</var>
+           .
+          <code title="dom-navigator">
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/timers.html#navigator">navigator</a>
+          </code>
+           .
+          <code title="dom-navigator-getNetworkServices">
+            <a href="#dom-navigator-getnetworkservices">getNetworkServices</a>
+          </code>
+          (
+          <var title="">type</var>
+          ,
+          <var title="">successCallback</var>
+           [,
+          <var title="">errorCallback</var>
+           ] )
+        </dt>
+        <dd>
+          <p>Prompts the user to select one or more discovered network services that have advertised support for the requested service type.</p>
+          <p>
+            The
+            <var title="">type</var>
+             argument contains one or more <a class="internalDFN" href="#dfn-valid-service-type">valid service type</a> tokens that the web page would like to interact with.
+          </p>
+          <p>
+            If the user accepts, the
+            <var title="">successCallback</var>
+             is
+          invoked, with one or more
+            <code>
+              <a href="#networkservice"><code>NetworkService</code></a>
+            </code>
+             objects as
+          its argument.
+          </p>
+          <p>
+            If the user declines, the
+            <var title="">errorCallback</var>
+             (if
+          any) is invoked.
+          </p>
+        </dd>
+      </dl>
+
+       <div>
+          <p>
+            When the <dfn id="dom-navigator-getnetworkservices" title="dom-navigator-getnetworkservices"><code>getNetworkServices(type, successCallback[, errorCallback])</code></dfn> method is called, the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> run the following steps:
+          </p>
+
+          <ol class="rule">
+            <li>
+               If <var>successCallback</var> is empty or is not an object of type <code>Function</code> then the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> abort these steps.
+            </li>
+
+            <li>
+              Let <var>requested control types</var> be initially set to an empty array.
+            </li>
+
+            <li>
+               If <var>type</var> is an array consisting of one or more <a class="internalDFN" href="#dfn-valid-service-type">valid service type</a> tokens, then let <var>requested control types</var> by the value of <var>type</var>, removing any non-<a class="internalDFN" href="#dfn-valid-service-type">valid service type</a> tokens from the resulting array.
+            </li>
+
+            <li>
+               If <var>type</var> is a string consisting of one <a class="internalDFN" href="#dfn-valid-service-type">valid service type</a> token, then let <var>requested control types</var> be an array containing one item with a value of <var>type</var>.
+            </li>
+
+            <li>
+               If <var>requested control types</var> is an array that contains at least one or more <a class="internalDFN" href="#dfn-valid-service-type" title="valid service type">valid service type</a> tokens then continue to the step labeled <em>process</em> below. Otherwise, the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose
+                 <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 2
+                  (<a href="#dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></a>) as its argument,
+                   abort any remaining steps and return.
+            </li>
+
+            <li>
+               <em>Process</em>: Let <var>services found</var> be an empty array.
+            </li>
+
+            <li>
+               For each <var>available service</var> in the <a class="internalDFN" href="#dfn-list-of-available-service-records">list of available service records</a> run the following steps:
+               <ol class="rule">
+                  <li>
+                    For each <var>requested control type</var> in <var>requested control types</var>: If <var>available service</var>'s <code>type</code> attribute equals the <var>requested control type</var> then let <var>matched service</var> equal the value of <var>available service</var> and continue at the step labeled <var>attach</var> below.
+                  </li>
+                  <li>
+                     Continue at the next <var>available service</var>.
+                  </li>
+                  <li>
+                     <em>Attach</em>: If <var>matched service</var> is not empty then run the following steps:
+
+                     <ol class="rule">
+                        <li>
+                           Let <var>new service object</var> be a new <a href="#networkservice"><code>NetworkService</code></a> object, mapping the parameters of
+                     <var>matched service</var> to this new object where possible.
+                        </li>
+                        <li>
+                           Append <var>new service object</var> to the <var>services found</var> array.
+                        </li>
+                     </ol>
+                  </li>
+               </ol>
+            </li>
+
+            <li>
+               If <var>services found</var> is an empty array, then the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose
+                 <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1
+                 (<a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its argument, abort any remaining steps and return.
+            </li>
+
+            <li>
+               Return, and run the remaining steps asynchronously.
+            </li>
+
+            <li>
+               Optionally, e.g. based on a previously-established user preference, for security reasons, or due to platform limitations, the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="may" class="rfc2119">may</em> <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose
+                 <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1
+                 (<a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its argument, abort any remaining steps and return.
+            </li>
+
+            <li>
+                  The <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> prompt the user in a user-agent-specific manner for permission to provide the
+                  <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" class="externalDFN">entry script</a>'s
+                  <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" class="externalDFN">origin</a> with an array of
+                  <a href="#networkservice"><code>NetworkService</code></a> objects representing the user-authorized subset of <var>services found</var>.
+
+               <p>
+                  If the user grants permission to access one or more networked services then the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="should" class="rfc2119">should</em> include an
+                  "ongoing local-network communication" indicator.
+               </p>
+
+               <p>If the user denies permission, then the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose
+                <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1
+                (<a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its argument, abort any remaining steps and return.
+              </p>
+
+              <p>
+                If the user never responds, this algorithm stalls on this step.
+              </p>
+
+            </li>
+
+            <li>
+               Let <var>services</var> be the array of one or more <a href="#networkservice"><code>NetworkService</code></a> objects for which the user granted permission.
+            </li>
+
+            <li>
+               For each Object <var>service</var> in <var>services</var>, run the following substeps:
+
+               <ol class="rule">
+                  <li>
+                     Add the <var>service</var>'s <code>url</code> parameter to the <a class="internalDFN" href="#dfn-entry-script-origin-s-url-whitelist">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a>.
+                  </li>
+                  <li>
+                    If <var>service</var> was originally created from a <abbr title="Universal Plug-and-Play">UPnP</abbr> discovery process and the <var>service</var>'s <code>eventsUrl</code> parameter is not empty then <a class="internalDFN" href="#dfn-setup-a-upnp-events-subscription">setup a <abbr title="Universal Plug-and-Play">UPnP</abbr> Events Subscription</a> for <var>service</var>.
+                  </li>
+               </ol>
+            </li>
+
+            <li>
+               Let <var>services manager</var> be a new <a href="#networkservices"><code>NetworkServices</code></a> object.
+            </li>
+
+            <li>
+               Set <var>services manager</var>'s <code>servicesAvailable</code> attribute to the length of <var>services</var>.
+            </li>
+
+            <li>
+              Store the set of <var>services</var> as <dfn id="current_authorized_services">current authorized services</dfn> internally against the newly created <var>services manager</var> object.
+            </li>
+
+            <li>
+               The <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>successCallback</var> with
+               <var>services manager</var> as its argument.
+            </li>
+
+          </ol>
+
+          <p>
+            The <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#task-source" class="externalDFN">task source</a> for these
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#concept-task" class="externalDFN">tasks</a> is the
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#user-interaction-task-source" class="externalDFN">user interaction task source</a>.
+          </p>
+
+          <p>
+            When a <a href="#networkservice"><code>NetworkService</code></a> object is provided to a Web page, the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> add the <code>url</code> property
+             to the <dfn id="dfn-entry-script-origin-s-url-whitelist">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</dfn>. This list enables the
+            Web page to override and initiate cross-site resource requests towards these URLs, and any sub-resources of these URLs, within the current
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" class="externalDFN">entry script</a>'s
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" class="externalDFN">origin</a> via various existing mechanisms (e.g. Web Sockets, Server-Sent Events,
+            Web Messaging, XMLHttpRequest).
+         </p>
+
+         <p>
+            If the user navigates away from the current browsing context, the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> remove all previously whitelisted urls from the <a class="internalDFN" href="#dfn-entry-script-origin-s-url-whitelist">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a>.
+            There is no persistence to network service selections provided to a web page. It is not possible to access a previously white-listed networked service without the necessary user authorization in all of the following cases:
+            </p><ul>
+              <li>If the current script is reloaded at any point in the same or different window.</li>
+              <li>if the current script reinvokes the <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> method at any point in its execution.</li>
+              <li>If the user navigates forward or back in their history to reload the current page.</li>
+              <li>If a script is running in a different origin.</li>
+            </ul>
+         <p></p>
+
+      </div>
+      </section>
+
+      <section id="error-handling">
+         <h3><span class="secno">4.2 </span>Error Handling</h3>
+
+      <dl class="domintro">
+        <dt>
+          <var title="">error</var>
+           .
+          <code title="dom-NavigatorNetworkServiceError-code">
+            <a href="#dom-navigatornetworkserviceerror-code">code</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            Returns the current error's error code. At the current time, this may be <code>1</code> or <code>2</code>, for which the
+            corresponding error constants
+            <a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a> and
+            <a href="#dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></a> are defined.
+          </p>
+        </dd>
+      </dl>
+
+         <p>
+            The <dfn id="dom-navigatornetworkserviceerror-code" title="dom-navigatornetworkserviceerror-code"><code>code</code></dfn> attribute of a
+            <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object <em title="must" class="rfc2119">must</em> return the code for the error, which will be one of the following:
+         </p>
+
+         <dl>
+            <dt>
+               <dfn id="dom-navigatornetworkserviceerror-permission_denied" title="dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></dfn> (numeric value 1)
+            </dt>
+            <dd>
+               The user denied the page permission to access any services.
+            </dd>
+            <dt>
+               <dfn id="dom-navigatornetworkserviceerror-unknown_type_prefix" title="dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></dfn> (numeric value 2)
+            </dt>
+            <dd>
+               No <a class="internalDFN" href="#dfn-valid-service-type">valid service type</a> tokens were provided in the method invocation.
+            </dd>
+         </dl>
+
+      </section>
+
+      </section>
+      <section id="obtaining-networked-services">
+      <!--OddPage--><h2><span class="secno">5. </span>Obtaining networked services</h2>
+
+      <p>
+         The <a href="#networkservices"><code>NetworkServices</code></a> interface is the top-level response object from a call to <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> and provides access to a set of user-authorized <a href="#networkservice"><code>NetworkService</code></a> objects for the given request.
+      </p>
+
+<pre class="widl">[NoInterfaceObject]
+interface <dfn id="networkservices">NetworkServices</dfn> {
+  readonly attribute unsigned long    <a href="#dom-networkservices-length">length</a>;
+  getter <a href="#networkservice">NetworkService</a> (unsigned long index);
+  <a href="#networkservice">NetworkService</a>? <a href="#dom-networkservices-getservicebyid">getServiceById</a>(DOMString id);
+
+  readonly attribute unsigned long    <a href="#dom-networkservices-servicesavailable">servicesAvailable</a>;
+
+  // event handler attributes
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservices-onserviceavailable">onserviceavailable</a>;
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservices-onserviceunavailable">onserviceunavailable</a>;
+
+};
+
+<a href="#networkservices">NetworkServices</a> implements <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-eventtarget" class="externalDFN">EventTarget</a>;
+</pre>
+
+      <section id="attributes">
+      <h3><span class="secno">5.1 </span>Attributes</h3>
+
+        <dl class="domintro">
+          <dt>
+            <code title="dom-networkservices-length">
+              <a href="#dom-networkservices-length">length</a>
+            </code>
+          </dt>
+          <dd>
+            <p>
+              Returns the current number of services in the respective object's <a class="internalDFN" href="#current_authorized_services">current authorized services</a>.
+            </p>
+          </dd>
+          <dt>
+            <code title="dom-networkservices-servicesavailable">
+              <a href="#dom-networkservices-servicesavailable">servicesAvailable</a>
+            </code>
+          </dt>
+          <dd>
+            <p>
+              Returns the current number of services matching one of the app-requested <a class="internalDFN" href="#dfn-valid-service-type">valid service type</a> tokens that are actively available within the user's current network.
+            </p>
+          </dd>
+        </dl>
+
+        <div>
+           <p>
+              The <dfn id="dom-networkservices-length"><code>length</code></dfn> attribute <em title="must" class="rfc2119">must</em> return the number of services represented in the object's corresponding <a class="internalDFN" href="#current_authorized_services">current authorized services</a> list at the time of getting.
+           </p>
+
+           <p>
+              The <dfn id="dom-networkservices-servicesavailable"><code>servicesAvailable</code></dfn> attribute <em title="must" class="rfc2119">must</em> return the number of services available in the
+              user's network that match the <a class="internalDFN" href="#dfn-valid-service-type">valid service type</a> that was initially used to create the current <a href="#networkservices"><code>NetworkServices</code></a> object.
+              By default, <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> <em title="must" class="rfc2119">must</em> be set to <code>1</code>.
+           </p>
+
+           <p>
+             When a previously unknown instance of a networked service matching one or the requested <a href="#dfn-valid-service-type">valid service types</a> becomes available on the user's current network, the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> fire a new simple
+             event at the <a href="#dom-networkservices-onserviceavailable"><code>onserviceavailable</code></a> event handler.
+           </p>
+
+           <p>
+             When a previously known instance of a networked service matching one or the requested <a href="#dfn-valid-service-type">valid service types</a> becomes unavailable on the user's current network, the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> fire a new simple
+             event at the <a href="#dom-networkservices-onserviceunavailable"><code>onserviceunavailable</code></a> event handler.
+           </p>
+        </div>
+
+      </section>
+
+      <section id="methods-1">
+      <h3><span class="secno">5.2 </span>Methods</h3>
+        <dl class="domintro">
+        <dt>
+          <code title="networkservices-getter">
+            <a href="#networkservices">services</a>
+          </code>
+          [
+          <var title="">index</var>
+          ]
+        </dt>
+        <dd>
+          <p>
+            Returns the specified <a href="#networkservice"><code>NetworkService</code></a> object.
+          </p>
+        </dd>
+        <dt>
+          <code title="networkservices-getter">
+            <a href="#networkservices">services</a>
+          </code>
+          .
+          <code title="dom-networkservices-getservicebyid">
+            <a href="#dom-networkservices-getservicebyid">getServiceById</a>
+          </code>
+          (
+          <var title="">id</var>
+          )
+        </dt>
+        <dd>
+          <p>
+            Returns the <a href="#networkservice"><code>NetworkService</code></a> object with the given identifier, or null if no
+            service has that identifier.
+          </p>
+        </dd>
+      </dl>
+
+      <p>
+        A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current list of zero or more <a class="internalDFN" href="#current_authorized_services">current authorized services</a>, of which zero or more can be available at a time. Each item in <a class="internalDFN" href="#current_authorized_services">current authorized services</a> is represented by a <a href="#networkservice"><code>NetworkService</code></a> object.
+      </p>
+
+      <div class="note"><div class="note-title"><span>Note</span></div><p class="">
+        Each service in a <a href="#networkservices"><code>NetworkServices</code></a> object thus has an index; the first has the index 0, and each subsequent service is numbered one higher than the previous one. If the <a class="internalDFN" href="#dfn-user-agent">user agent</a> dynamically adds or removes network services for any reason, then the indices of the services in <a class="internalDFN" href="#current_authorized_services">current authorized services</a> will change dynamically. If the set of network services changes entirely, then all the previous services will be removed from <a class="internalDFN" href="#current_authorized_services">current authorized services</a> and replaced with new services.
+      </p></div>
+
+      <p>
+        The <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#supported-property-indices" class="externalDFN">supported property indices</a> of <a href="#networkservices"><code>NetworkServices</code></a> objects at any instant are the numbers from zero to the number of items in <a class="internalDFN" href="#current_authorized_services">current authorized services</a> represented by the respective object minus one, if any services are represented in <a class="internalDFN" href="#current_authorized_services">current authorized services</a>. If a <a href="#networkservices"><code>NetworkServices</code></a> object represents no <a class="internalDFN" href="#current_authorized_services">current authorized services</a>, it has no <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#supported-property-indices" class="externalDFN">supported property indices</a>.
+      </p>
+
+      <p>
+        To <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#determine-the-value-of-an-indexed-property" class="externalDFN">determine the value of an indexed property</a> for a given index <var>index</var> in a <a href="#networkservices"><code>NetworkServices</code></a> object's <a class="internalDFN" href="#current_authorized_services">current authorized services</a>, the user agent <em title="must" class="rfc2119">must</em> return the <a href="#networkservice"><code>NetworkService</code></a> object that represents the <var>index</var>th service in <a class="internalDFN" href="#current_authorized_services">current authorized services</a>.
+      </p>
+
+      <p>
+        The <dfn id="dom-networkservices-getservicebyid"><code>getServiceById(id)</code></dfn> method <em title="must" class="rfc2119">must</em> return the first <a href="#networkservice"><code>NetworkService</code></a> object in <a class="internalDFN" href="#current_authorized_services">current authorized services</a> represented by the respective object whose <a href="#dom-networkservice-id"><code>id</code></a> attribute is equal to the value of the <var>id</var> argument.
+        When no services in <a class="internalDFN" href="#current_authorized_services">current authorized services</a> match the given argument, the method <em title="must" class="rfc2119">must</em> return null.
+      </p>
+
+      <p>
+         Services available within the local network can connect and disconnect at different times during the execution of a web page. A <a class="internalDFN" href="#dfn-user-agent">user agent</a> can
+         inform a web page when the state of networked services matching the requested <a class="internalDFN" href="#dfn-valid-service-type">valid service type</a> change. Web pages can use this information to enable in-page experiences for communicating the state of networked services
+         with the ability to change the particular service or set of services the page is connected to by re-invoking the <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> method.
+      </p>
+
+      </section>
+
+      <section id="events">
+      <h3><span class="secno">5.3 </span>Events</h3>
+
+      <p>
+         The following are the event handlers (and their corresponding event handler event types) that must be supported, as IDL attributes, by all objects implementing the <a href="#networkservices"><code>NetworkServices</code></a> interface:
+       </p>
+
+       <table border="1">
+        <thead>
+          <tr>
+            <th>
+              <span title="event handlers">Event handler</span>
+            </th>
+            <th>
+              <span>Event handler event type</span>
+            </th>
+          </tr>
+        </thead>
+        <tbody>
+          <tr>
+            <td>
+              <dfn id="dom-networkservices-onserviceavailable" title="dom-NetworkServices-onserviceavailable">
+                <code>onserviceavailable</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-serviceavailable">serviceavailable</code>
+            </td>
+          </tr>
+          <tr>
+            <td>
+              <dfn id="dom-networkservices-onserviceunavailable" title="dom-NetworkServices-onserviceunavailable">
+                <code>onserviceunavailable</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-serviceunavailable">serviceunavailable</code>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+
+      <p>
+         Events with an event type of <code>serviceavailable</code> or <code>serviceunavailable</code> defined in this specification are simple <code>Event</code> objects.
+      </p>
+
+      </section>
+
+    </section>
+    <section id="communicating-with-a-networked-service">
+    <!--OddPage--><h2><span class="secno">6. </span>Communicating with a networked service</h2>
+
+<p>
+   The <a href="#networkservice"><code>NetworkService</code></a> interface is used to provide a set of connection information for an <abbr title="Hypertext Transfer Protocol">HTTP</abbr> service endpoint and if available, service events, running on a networked device.
+</p>
+
+<pre class="widl">[NoInterfaceObject]
+interface <dfn id="networkservice">NetworkService</dfn> {
+  readonly attribute DOMString        <a href="#dom-networkservice-id">id</a>;
+  readonly attribute DOMString        <a href="#dom-networkservice-name">name</a>;
+  readonly attribute DOMString        <a href="#dom-networkservice-type">type</a>;
+  readonly attribute DOMString        <a href="#dom-networkservice-url">url</a>;
+  readonly attribute DOMString        <a href="#dom-networkservice-config">config</a>;
+
+  const unsigned short <a href="#dom-networkservice-AVAILABLE">AVAILABLE</a>      = 1;
+  const unsigned short <a href="#dom-networkservice-UNAVAILABLE">UNAVAILABLE</a>    = 2;
+  readonly attribute unsigned short   <a href="#dom-networkservice-readystate">readyState</a>;
+
+  // event handler attributes
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservice-onreadystatechange">onreadystatechange</a>;
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservice-onmessage">onmessage</a>;
+};
+
+<a href="#networkservice">NetworkService</a> implements <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-eventtarget" class="externalDFN">EventTarget</a>;
+</pre>
+
+<section id="attributes-1">
+  <h3><span class="secno">6.1 </span>Attributes</h3>
+
+      <dl class="domintro">
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-id">
+            <a href="#dom-networkservice-id">id</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            A unique identifier for the given user-selected service instance.
+          </p>
+        </dd>
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-name">
+            <a href="#dom-networkservice-name">name</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            The name of the user-selected service.
+          </p>
+        </dd>
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-type">
+            <a href="#dom-networkservice-type">type</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            The <a class="internalDFN" href="#dfn-valid-service-type">valid service type</a> token value of the user-selected service.
+          </p>
+        </dd>
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-url">
+            <a href="#dom-networkservice-url">url</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            The control <abbr title="Uniform Resource Locator">URL</abbr> endpoint (including any required port information) of the user-selected control service that has been added to the <a class="internalDFN" href="#dfn-entry-script-origin-s-url-whitelist">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a>.
+          </p>
+        </dd>
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-config">
+            <a href="#dom-networkservice-config">config</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            The configuration information associated with the service depending on the requested service type.
+          </p>
+        </dd>
+      </dl>
+
+          <p>
+            The <dfn id="dom-networkservice-id"><code>id</code></dfn> attribute is a unique identifier for the service. Two services provided at different times or on different objects <em title="must" class="rfc2119">must</em> have the same <a href="#dom-networkservice-id"><code>id</code></a> value.
+         </p>
+
+         <p>
+            The <dfn id="dom-networkservice-name"><code>name</code></dfn> attribute represents a human-readable title for the service.
+         </p>
+
+         <p>
+             The <dfn id="dom-networkservice-type"><code>type</code></dfn> attribute reflects the value of the <a class="internalDFN" href="#dfn-valid-service-type">valid service type</a> of the service.
+          </p>
+
+         <p>
+            The <dfn id="dom-networkservice-url"><code>url</code></dfn> attribute is an <a href="http://www.w3.org/TR/html5/urls.html#absolute-url" class="externalDFN">absolute <abbr title="Uniform Resource Locator">URL</abbr></a> pointing to the root <abbr title="Hypertext Transfer Protocol">HTTP</abbr>
+            endpoint for the service that has been added to the <a class="internalDFN" href="#dfn-entry-script-origin-s-url-whitelist">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a>. Web pages can subsequently use this value for implicit cross-document messaging via various existing mechanisms (e.g. Web Sockets, Server-Sent Events, Web Messaging, XMLHttpRequest).
+         </p>
+
+         <p>
+            The <dfn id="dom-networkservice-config"><code>config</code></dfn> attribute provides the raw configuration information extracted from the given network service.
+         </p>
+
+      </section>
+
+      <section id="states">
+         <h3><span class="secno">6.2 </span>States</h3>
+
+      <dl class="domintro">
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-readystate">
+            <a href="#dom-networkservice-readystate">readyState</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            Returns the current state.
+          </p>
+        </dd>
+      </dl>
+
+         A <a href="#networkservice"><code>NetworkService</code></a> object can be in several states. The <dfn id="dom-networkservice-readystate"><code>readyState</code></dfn> attribute <em title="must" class="rfc2119">must</em> return the current state of the networked service,
+         which <em title="must" class="rfc2119">must</em> be one of the following values:
+
+         <dl>
+           <dt>
+             <dfn id="dom-networkservice-AVAILABLE" title="dom-networkservice-AVAILABLE">
+               <code>AVAILABLE</code>
+             </dfn>
+              (numeric value
+             1)
+
+
+           </dt>
+           <dd>
+             <p>The object is connected to its service endpoint.
+
+            </p>
+           </dd>
+           <dt>
+             <dfn id="dom-networkservice-UNAVAILABLE" title="dom-networkservice-UNAVAILABLE">
+               <code>UNAVAILABLE</code>
+             </dfn>
+              (numeric value
+             2)
+           </dt>
+           <dd>
+             <p>The object is not connected to its service endpoint.
+            </p>
+           </dd>
+         </dl>
+
+      </section>
+
+      <section id="events-1">
+         <h3><span class="secno">6.3 </span>Events</h3>
+
+      <p>
+         The following are the event handlers (and their corresponding event handler event types) that must be supported, as IDL attributes, by all objects implementing the
+         <a href="#networkservice"><code>NetworkService</code></a> interface:
+       </p>
+
+       <table border="1">
+        <thead>
+          <tr>
+            <th>
+              <span title="event handlers">Event handler</span>
+            </th>
+            <th>
+              <span>Event handler event type</span>
+            </th>
+          </tr>
+        </thead>
+        <tbody>
+          <tr>
+            <td>
+              <dfn id="dom-networkservice-onmessage" title="dom-NetworkService-onmessage">
+                <code>onmessage</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-message">message</code>
+            </td>
+          </tr>
+          <tr>
+            <td>
+              <dfn id="dom-networkservice-onreadystatechange" title="dom-NetworkService-onreadystatechange">
+                <code>onreadystatechange</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-onreadystatechange">readystatechange</code>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+
+      <p>
+         Events with an event type of <code>message</code> defined in this specification are <a href="http://dev.w3.org/html5/postmsg/#messageevent" class="externalDFN"><code>MessageEvent</code></a> objects as defined in [<cite><a href="#bib-POSTMSG" class="bibref">POSTMSG</a></cite>].
+      </p>
+
+      <p>
+         Events with an event type of <code>readystatechange</code> defined in this specification are simple <code>Event</code> objects.
+      </p>
+
+      </section>
+   </section>
+
+      <section id="service-discovery">
+            <!--OddPage--><h2><span class="secno">7. </span>Service Discovery</h2>
+
+      <p>
+         A <a class="internalDFN" href="#dfn-user-agent">user agent</a> conforming to this specification <em title="may" class="rfc2119">may</em> implement <abbr title="Simple Service Discovery Protocol">SSDP</abbr> [<cite><a href="#bib-UPNP-DEVICEARCH11" class="bibref">UPNP-DEVICEARCH11</a></cite>] and Zeroconf [<cite><a href="#bib-ZEROCONF" class="bibref">ZEROCONF</a></cite>] service discovery mechanisms
+         to enable Web pages to request and connect with <abbr title="Hypertext Transfer Protocol">HTTP</abbr> services running on networked devices, discovered via either mechanism, through this <abbr title="Application Programming Interface">API</abbr>. When a <a class="internalDFN" href="#dfn-user-agent">user agent</a> implements either of these service discovery mechanisms, then it <em title="must" class="rfc2119">must</em> conform to the corresponding algorithms provided in this section of the specification.
+      </p>
+      <p>
+         This section presents how the results of these two service discovery
+         mechanisms will be matched to requested service types and how their properties will be applied to any resulting <a href="#networkservice"><code>NetworkService</code></a> objects.
+      </p>
+
+      <p>
+         It is expected that user agents will perform these service discovery mechansisms asynchronously and periodically update the <a>list of networked devices</a> as required. The timing of any
+         service discovery mechanisms is an implementation detail left to the discretion of the implementer (e.g. once on user agent start-up, every X seconds during user agent execution or on
+         invocation of this <abbr title="Application Programming Interface">API</abbr> from a Web page).
+      </p>
+
+      <p>
+         The <dfn id="dfn-list-of-available-service-records">list of available service records</dfn> is a single dynamic internal lookup table within user agents that is used to track the current services available in the network at any given time.
+         At any point during the running of either of the two service discovery mechanisms then existing entries within this table can be updated, entries can be added and entries can be removed as the status of networked
+         services changes. Each record contained within this table contains the attributes: <code>id</code>, <code>name</code>, <code>type</code>, <code>url</code> and <code>config</code>.
+      </p>
+
+            <section id="zeroconf-mdns-dns-sd">
+         <h3><span class="secno">7.1 </span>Zeroconf (<abbr title="Multicast DNS">mDNS</abbr> + <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr>)</h3>
+
+         <p>
+            For each <abbr title="Domain Name System">DNS</abbr> response received from a user-agent-initiated Multicast <abbr title="Domain Name System">DNS</abbr> Browse for <abbr title="DNS Pointer Record">PTR</abbr> records with the name <code>_services._dns-sd._udp</code> on the resolved recommended automatic browsing
+   domain [<cite><a href="#bib-MDNS" class="bibref">MDNS</a></cite>], the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> run the following steps:
+         </p>
+
+         <ol class="rule">
+
+            <li>Let <var>service <abbr title="Multicast DNS">mDNS</abbr> responses</var> be an array of <abbr title="DNS Pointer Record">PTR</abbr> records received by issuing a Multicast <abbr title="Domain Name System">DNS</abbr> Browse for <abbr title="DNS Pointer Record">PTR</abbr> records with the name of the current discovered service type.</li>
+
+            <li>For each Object <var>service <abbr title="Multicast DNS">mDNS</abbr> response</var> in <var>service <abbr title="Multicast DNS">mDNS</abbr> responses</var>, run the following steps:
+               <ol>
+
+                  <li>
+                     Let <var>network service record</var> be an Object consisting of the following empty properties: <code>id</code>, <code>name</code>, <code>type</code>, <code>url</code>, <code>config</code>.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>id</code> property to the value of the full <abbr title="DNS Pointer Record">PTR</abbr> Service Instance Name [<cite><a href="#bib-MDNS" class="bibref">MDNS</a></cite>].
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>name</code> property to the value of the <abbr title="DNS Pointer Record">PTR</abbr> Service Instance Name's <var>Instance</var> component [<cite><a href="#bib-MDNS" class="bibref">MDNS</a></cite>].
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>type</code> property to the concatenation of the string <code>zeroconf:</code> followed by the value of the <abbr title="DNS Pointer Record">PTR</abbr> Service Instance Name's <var>Service</var> component [<cite><a href="#bib-MDNS" class="bibref">MDNS</a></cite>].
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>url</code> property to the resolvable Service <abbr title="Uniform Resource Locator">URL</abbr> obtained from performing an <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr> Lookup [<cite><a href="#bib-DNS-SD" class="bibref">DNS-SD</a></cite>] of the current service from the <abbr title="DNS Pointer Record">PTR</abbr> record provided [<cite><a href="#bib-MDNS" class="bibref">MDNS</a></cite>].
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>config</code> property to the string value of the contents of the first <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr> TXT record associated with the <var>service <abbr title="Multicast DNS">mDNS</abbr> response</var> as defined in [<cite><a href="#bib-DNS-SD" class="bibref">DNS-SD</a></cite>].
+                  </li>
+
+                  <li>
+                     For each Object <var>existing service record</var> in the current <a class="internalDFN" href="#dfn-list-of-available-service-records">list of available service records</a>, run the following sub-steps:
+                     <ol class="rule">
+
+                       <li>
+                        If the <var>existing service record</var>'s <code>id</code> property matches the value of the <var>network service record</var>'s <code>id</code>, then set the
+                        value of <var>existing service record</var> in the current <a class="internalDFN" href="#dfn-list-of-available-service-records">list of available service records</a>  to the value of the
+                        <var>network service record</var> and skip the next step.
+                       </li>
+                     </ol>
+                  </li>
+
+                  <li>
+                     Add <var>network service record</var> to the <a class="internalDFN" href="#dfn-list-of-available-service-records">list of available service records</a>.
+                  </li>
+
+                  <li>
+                     For each non-garbage collected <a href="#networkservice"><code>NetworkService</code></a> object run the following steps:
+
+                     <ol class="rule">
+                        <li>
+                           If the <a href="#networkservice"><code>NetworkService</code></a> object's <code>type</code> attribute does not equal the
+                           current <a>network service record</a>'s <code>type</code> property then continue at the next available active
+                           <a href="#networkservice"><code>NetworkService</code></a> object.
+                        </li>
+                        <li>
+                           Increment the <code>servicesAvailable</code> attribute of the <a href="#networkservices"><code>NetworkServices</code></a> object by <code>1</code>.
+                        </li>
+                     </ol>
+                  </li>
+            </ol>
+           </li>
+         </ol>
+
+      </section>
+
+      <section id="universal-plug-and-play-upnp">
+         <h3><span class="secno">7.2 </span>Universal Plug-and-Play (<abbr title="Universal Plug-and-Play">UPnP</abbr>)</h3>
+
+         <p>
+            For each <abbr title="Simple Service Discovery Protocol">SSDP</abbr> Presence Announcement [<cite><a href="#bib-UPNP-DEVICEARCH11" class="bibref">UPNP-DEVICEARCH11</a></cite>] - a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> NOTIFY request - received from a user-agent-initiated <abbr title="Simple Service Discovery Protocol">SSDP</abbr> Discovery Request [<cite><a href="#bib-UPNP-DEVICEARCH11" class="bibref">UPNP-DEVICEARCH11</a></cite>], the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> run the following steps:
+         </p>
+
+         <ol class="rule">
+            <li>
+               Let <var>ssdp device</var> be an Object with a property for each <abbr title="Hypertext Transfer Protocol">HTTP</abbr> header received in the received <abbr title="Simple Service Discovery Protocol">SSDP</abbr> Presence Announcement, with each key being the name of a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> header and its
+               value being that <abbr title="Hypertext Transfer Protocol">HTTP</abbr> header's accompanying value.
+            </li>
+
+            <li>
+               If <var>ssdp device</var> does not contain at least one <var>NTS</var>, <var>USN</var> and <var>Location</var> parameter, then the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> abort these steps.
+            </li>
+
+            <li>
+               If the first occurrence of <var>NTS</var> has a value other than <code>ssdp:alive</code>, then continue to the step labeled <var>update service monitor</var> below.
+            </li>
+
+            <li>
+               Let <var>root device descriptor file</var> contain the contents of the file located at the <abbr title="Uniform Resource Locator">URL</abbr> provided in the first occurrence of <var>Location</var> obtained according to the rules
+               defined in the section 'Retrieving a description using <abbr title="Hypertext Transfer Protocol">HTTP</abbr>' [<cite><a href="#bib-UPNP-DEVICEARCH11" class="bibref">UPNP-DEVICEARCH11</a></cite>].
+            </li>
+
+            <li>
+               If <var>root device descriptor file</var> is empty, then the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> abort these steps.
+            </li>
+
+            <li>
+               Let <var>advertised services</var> be a <a>list of all advertised services</a> obtained from the <var>root device descriptor file</var> containing all sub-nodes of the <code>serviceList</code> node as described in
+               the section 'Device Description' [<cite><a href="#bib-UPNP-DEVICEARCH11" class="bibref">UPNP-DEVICEARCH11</a></cite>].
+            </li>
+
+            <li>
+               For each Object <var>advertised service</var> in <var>advertised services</var> run the following steps:
+               <ol class="rule">
+
+                  <li>
+                     Let <var>network service record</var> be an Object consisting of the following empty properties: <code>id</code>, <code>name</code>, <code>type</code>, <code>url</code>, <code>eventsUrl</code>, <code>config</code>.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>id</code> property to the string value of the first occurrence of <var>ssdp device</var>'s <var>USN</var> parameter.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>name</code> property to the string value of the first occurrence of the <var>service</var>'s <code>serviceId</code> property.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>type</code> property to the concatenation of the string <code>upnp:</code> followed by the string value of the first occurrence of the <var>service</var>'s <code>serviceType</code> property.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>url</code> property to the string value of the first occurrence of the <var>service</var>'s <code>controlURL</code> property.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>config</code> property to the string value of the first occurrence of the <var>device</var> property.
+                  </li>
+
+                  <li>
+                     If <var>service</var>'s <code>eventSubURL</code> property is empty, then continue to the step labeled <em>register</em> below.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>eventsUrl</code> property to the string value of the first occurrence of the <var>service</var>'s <code>eventSubURL</code> property.
+                  </li>
+
+                  <li>
+                     <em>Register</em>: For each Object <var>existing service record</var> in the current <a class="internalDFN" href="#dfn-list-of-available-service-records">list of available service records</a>, run the following sub-steps:
+                     <ol class="rule">
+
+                       <li>
+                        If the <var>existing service record</var>'s <var>id</var> property matches the value of the first occurrence of <var>USN</var> and the
+                        <var>existing service record</var>'s <code>type</code> property matches the value of <var>network service record</var>'s <code>type</code>, then set the
+                        value of <var>existing service record</var> in the current <a class="internalDFN" href="#dfn-list-of-available-service-records">list of available service records</a>  to the value of the
+                        <var>network service record</var> and skip the next step.
+                       </li>
+                     </ol>
+                  </li>
+
+                  <li>
+                     Add <var>network service record</var> to the <a class="internalDFN" href="#dfn-list-of-available-service-records">list of available service records</a>.
+                  </li>
+
+               </ol>
+            </li>
+            <li>
+               <em>Update Service Monitor</em>: For each non-garbage collected <a href="#networkservice"><code>NetworkService</code></a> object run the following steps:
+
+               <ol class="rule">
+                  <li>
+                     If this <a href="#networkservice"><code>NetworkService</code></a> object's <code>type</code> attribute does not equal the
+                     current <a>network service record</a>'s <code>type</code> property then continue at the next available active
+                     <a href="#networkservice"><code>NetworkService</code></a> object.
+                  </li>
+                  <li>
+                     If the <var>announcement type</var> equals <code>ssdp:alive</code> then Increment the <code>servicesAvailable</code> attribute of the <a href="#networkservices"><code>NetworkServices</code></a>
+                     object by <code>1</code>. Otherwise, decrement the <code>servicesAvailable</code> attribute of the <a href="#networkservices"><code>NetworkServices</code></a>
+                     object by <code>1</code>.
+                  </li>
+               </ol>
+            </li>
+         </ol>
+
+         <p>
+            A <dfn id="dfn-user-agent-generated-callback-url">user-agent generated callback url</dfn> is a Local-network accessible <abbr title="Uniform Resource Locator">URL</abbr> endpoint that a <a class="internalDFN" href="#dfn-user-agent">user agent</a> must generate and maintain for receiving <abbr title="Hypertext Transfer Protocol">HTTP</abbr> NOTIFY requests from <abbr title="Universal Plug-and-Play">UPnP</abbr> Event sources.
+         </p>
+
+         <p>When the <a class="internalDFN" href="#dfn-user-agent">user agent</a> is to <dfn id="dfn-setup-a-upnp-events-subscription">setup a <abbr title="Universal Plug-and-Play">UPnP</abbr> Events Subscription</dfn>, it is to run the following steps with the current <var>network service record</var> object:</p>
+
+         <ol class="rule">
+            <li>
+               If <var>network service record</var>'s <code>eventsUrl</code> property is empty then the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> abort these steps.
+            </li>
+
+            <li>
+               Let <var>callback <abbr title="Uniform Resource Locator">URL</abbr></var> be the value of creating a new <a class="internalDFN" href="#dfn-user-agent-generated-callback-url">user-agent generated callback url</a>.
+            </li>
+
+            <li>
+               Send a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> SUBSCRIBE request with a <em>NT</em> header with a string value of <code>upnp:event</code>, a <em>TIMEOUT</em> header with an integer value of
+               <code>86400</code> and a <em>CALLBACK</em> header
+               with a string value of <var>callback <abbr title="Uniform Resource Locator">URL</abbr></var> towards the <var>network service record</var>'s <code>eventsUrl</code> property.
+            </li>
+
+            <li>
+               If a non-200 OK response is received from the <abbr title="Hypertext Transfer Protocol">HTTP</abbr> SUBSCRIBE request then the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> abort these steps.
+            </li>
+
+            <li>
+               On receiving a valid 200 OK response, run the following steps:
+
+               <ol class="rule">
+                  <li>
+                     Let <var>callback ID</var> equal the string value of the first included <em>SID</em> header, if it exists.
+                  </li>
+                  <li>
+                     Let <var>timeout date</var> equal the sum of the current UTC date value plus the integer value of the first included <em>TIMEOUT</em> header, if it exists.
+                  </li>
+                  <li>
+                     Run the following steps aynchronously and continue to the step labeled <em>listen</em> below.
+                  </li>
+                  <li>
+                     <em>Refresh Subscription</em>: Run the following steps at a set interval (X) within the <a class="internalDFN" href="#dfn-user-agent">user agent</a>:
+
+                     <ol class="rule">
+                        <li>
+                           Let <var>current date</var> equal the current UTC date.
+                        </li>
+                        <li>
+                           If <var>current date</var> is less than the <var>timeout date</var> then continue to the step labeled <em>refresh subscription</em> above.
+                        </li>
+                        <li>
+                           Send a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> SUBSCRIBE request with a <em>SID</em> header with the string value of <var>callback ID</var> and a <em>TIMEOUT</em> header
+                           with an integer value of <code>86400</code> towards the <var>network service record</var>'s <code>eventsUrl</code> property.
+                        </li>
+                        <li>
+                           On receiving a valid 200 OK, update <var>callback ID</var> with the string value of the first included <em>SID</em> header, if it exists. All other <abbr title="Hypertext Transfer Protocol">HTTP</abbr>
+                           responses should cause the <a class="internalDFN" href="#dfn-user-agent">user agent</a> to continue from the step labeled <em>refresh subscription</em> above.
+                        </li>
+                     </ol>
+
+                  </li>
+
+                  <li>
+                     <em>Listen</em>: For each <abbr title="Hypertext Transfer Protocol">HTTP</abbr> NOTIFY request received at the <var>callback <abbr title="Uniform Resource Locator">URL</abbr></var> the <a class="internalDFN" href="#dfn-user-agent">user agent</a> is to run the following steps:
+
+                     <ol class="rule">
+                        <li>
+                           Let <var>content clone</var> be the result of obtaining the message body of the <abbr title="Hypertext Transfer Protocol">HTTP</abbr> NOTIFY request. If <var>content clone</var> is empty, then the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> abort these steps.
+                        </li>
+                        <li>
+                          Create a new <code>message</code> event that uses the <a href="http://dev.w3.org/html5/postmsg/#messageevent" class="externalDFN"><code>MessageEvent</code></a> interface [<cite><a href="#bib-POSTMSG" class="bibref">POSTMSG</a></cite>], with the name <code>message</code>,
+                           which does not bubble, is not cancelable, and has no default action.
+                        </li>
+                        <li>
+                           Let the <code>data</code> attribute of the event have the DOMString value of <var>content clone</var>.
+                        </li>
+                        <li>
+                           <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">Queue a task</a> to
+                            dispatch the newly created event at the current <a class="internalDFN" href="#networkservice"><code>NetworkService</code></a> object.
+                        </li>
+                     </ol>
+                  </li>
+
+               </ol>
+
+            </li>
+         </ol>
+
+         </section>
+
+         <section id="network-topology-monitoring">
+            <h3><span class="secno">7.3 </span>Network Topology Monitoring</h3>
+
+                  <div>
+                     <p>
+                        When the <a class="internalDFN" href="#dfn-user-agent">user agent</a> detects that the user has dropped from their connected network, then it <em title="must" class="rfc2119">must</em> run the following steps:
+                     </p>
+
+                     <ol class="rule">
+                        <li>
+                           Flush all entries from the <a class="internalDFN" href="#dfn-list-of-available-service-records">list of available service records</a>.
+                        </li>
+                        <li>
+                           For each <a href="#networkservice"><code>NetworkService</code></a> object currently active in the <a class="internalDFN" href="#dfn-user-agent">user agent</a> perform the following steps:
+
+                           <ol class="rule">
+                              <li>
+                                 Set the <a href="#dom-networkservice-readystate"><code>readyState</code></a> attribute to <code>2</code> (<a href="#dom-networkservice-UNAVAILABLE"><code>UNAVAILABLE</code></a>).
+                              </li>
+                              <li>
+                                 Create a new <code>readystatechange</code> event that uses the <code>Event</code> interface which does not bubble, is not cancelable, and has no default action.
+                              </li>
+                              <li>
+                                 <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">Queue a task</a> to
+                                        dispatch the newly created event at the <a href="#networkservice"><code>NetworkService</code></a> object.
+                              </li>
+                           </ol>
+                        </li>
+                     </ol>
+
+                     <p>
+                        When the <a class="internalDFN" href="#dfn-user-agent">user agent</a> detects that the user has connected to a new network, then it <em title="should" class="rfc2119">should</em> run the following steps:
+                     </p>
+
+                     <ol class="rule">
+                        <li>
+                           Re-issue an <abbr title="Multicast DNS">mDNS</abbr> search and <abbr title="Simple Service Discovery Protocol">SSDP</abbr> discovery search and handle the responses according to the processing defined in <a href="#service-discovery">Section 6: Service Discovery</a>.
+                        </li>
+                     </ol>
+                  </div>
+         </section>
+      </section>
+
+   <section id="garbage-collection">
+      <!--OddPage--><h2><span class="secno">8. </span>Garbage collection</h2>
+
+      <p>
+         A <a class="internalDFN" href="#networkservice"><code>NetworkService</code></a> object containing a <code>url</code> parameter currently in the <a class="internalDFN" href="#dfn-entry-script-origin-s-url-whitelist">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a> <em title="must not" class="rfc2119">must not</em> be garbage collected.
+      </p>
+
+      <p>
+         Only when the user navigates away from the current browsing context can <a class="internalDFN" href="#networkservice"><code>NetworkService</code></a> objects be garbage-collected and records in the <a class="internalDFN" href="#dfn-entry-script-origin-s-url-whitelist">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a> be removed.
+      </p>
+
+   </section>
+
+
+    <section id="use-cases-and-requirements">
+      <!--OddPage--><h2><span class="secno">9. </span>Use Cases and Requirements</h2>
+
+      <p>This section covers what the requirements are for this <abbr title="Application Programming Interface">API</abbr>, as well as illustrates some use cases.</p>
+
+      <ul class="rule">
+         <li>
+            Once a user has given permission, user agents should provide the ability for Web pages to communicate directly with a Local-networked Service.
+            <ul class="rule">
+               <li>
+                  Example: A web-based TV remote control. A Web page wants to control the current user's TV, changing the programming shown or increasing/decreasing/muting the
+                  volume of the Local-networked Device. The Web page requests a service type that is known to be implemented by television sets to which it has the
+                  application logic to communicate. Local devices providing the request service types are discovered and presented to the user for authorization. The user selects one
+                  or more of the discovered television sets to be accessible to the current Web page and then clicks 'Share'. The Web page can now communicate directly with
+                  the user-authorized Local-networked services.
+               </li>
+            </ul>
+         </li>
+
+         <li>
+           Web pages should be able to communicate with Local-networked Services using the messaging channel supported by those Devices.
+           <ul class="rule">
+            <li>
+               Example: A Web page advertises that it is capable of controlling multiple Home Media Servers. The user can select their Home Media Server type from a drop-down list, at which point the
+               Web page sends a request to the user agent to connect with the associated service type of the Home Media Server. The Media Server selected implements a Web Socket channel for
+               bi-directional service communication and so the Web page opens a web socket to the requested Media Server and can communicate as required via that appropriate channel.
+            </li>
+           </ul>
+         </li>
+
+         <li>
+           Web pages should be able to communicate with Local-networked Services using the messaging format supported by those Devices.
+           <ul class="rule">
+            <li>
+               Example: A Web page advertises that it is capable of interacting with and controlling multiple types of Home Media Server. The user can select their Home Media Server type from a drop-down list or known Media Servers, at which point the
+               Web page sends a request to the user agent to connect with the associated service type (and, optionally, the associated event type) of the Home Media Server. The communiciation protocols supported by Home Media Servers typically vary
+               between <abbr title="Universal Plug-and-Play">UPnP</abbr>, JSON-RPC, Protocol Buffers or other messaging formats depending on the Home Media Server requested. The Web page is able to communicate with the user-selected Home Media
+               Server in the messaging format supported by that Device, which, in this example is a simple key/value pair text format.
+            </li>
+           </ul>
+         </li>
+
+         <li>
+           Web pages should not be able to communicate with Local-networked Services that have not been authorized by the user thereby maintaining the user's privacy.
+           <ul class="rule">
+            <li>
+               Example: A Web page requests access to one type of Local-networked service. The user authorizes access to that particular service. Other services running on that same device, and on other devices
+               within the network, should not be accessible to the current Web page.
+            </li>
+           </ul>
+         </li>
+
+         <li>
+           A user should be able to share one or more Local-networked Services based on a particular service type request from a Web page.
+           <ul class="rule">
+            <li>
+               Example: A Web page is capable of interacting with a specific profile of Local-networked Service. As such, it makes a request to the user agent to access those services, of which multiple matches
+               are found. The user is capable of selecting one or more of the discovered services to share with the Web page. The Web page can then implement a drag-and-drop interface for the user to drag specific
+               actions on to one or more of the authorized Local-networked Services.
+            </li>
+           </ul>
+         </li>
+
+         <li>
+           User agents should provide an <abbr title="Application Programming Interface">API</abbr> exposed to script that exposes the features above. The user is notified by UI anytime interaction with Local-networked Services is requested, giving the user
+           full ability to cancel or abort the transaction. The user selects the Local-networked Services to be connected to the current Web page, and can cancel these at any time. No invocations to
+           these APIs occur silently without user intervention.
+         </li>
+      </ul>
+    </section>
+
+          <section id="examples" class="informative appendix">
+             <!--OddPage--><h2><span class="secno">A. </span>Examples</h2><p><em>This section is non-normative.</em></p>
+
+           <div class="example">
+            <p>This sample code exposes a button. When clicked, this button is disabled and the user is prompted to offer a network service. The user may also select multiple network services. When the user has authorized a network service to be connected to the web page then the web page issues a simple command to get a list of all the albums stored on the connected media player service.
+            </p><p>The button is re-enabled only when the connected network service disconnects for whatever reason (the service becomes unavailable on the network, the user disconnects from their current network or the user revokes access to the service from the current web page). At this point the user can re-click the button to select a new network service to connect to the web page and the above steps are repeated.</p>
+            <p>The provided service type identifier and service interaction used in this example is based on the well-defined service type and messaging format supported by the <a href="http://xbmc.org/about/">XBMC Media Server</a>. </p>
+            <hr>
+            <pre class="highlight prettyprint"><span class="tag">&lt;input</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"button"</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">"Start"</span><span class="pln"> </span><span class="atn">onclick</span><span class="pun">=</span><span class="atv">"</span><span class="pln">start</span><span class="pun">()</span><span class="atv">"</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"startBtn"</span><span class="tag">/&gt;</span><span class="pln">
+</span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"debugconsole"</span><span class="tag">&gt;&lt;/div&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"> startBtn </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">'startBtn'</span><span class="pun">),</span><span class="pln">
+     debug </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">'debugconsole'</span><span class="pun">);</span><span class="pln">
+
+ </span><span class="kwd">function</span><span class="pln"> start</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+   </span><span class="kwd">if</span><span class="pun">(</span><span class="pln">navigator</span><span class="pun">.</span><span class="pln">getNetworkServices</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">getNetworkServices</span><span class="pun">(</span><span class="str">'zeroconf:_xbmc-jsonrpc._tcp'</span><span class="pun">,</span><span class="pln"> gotXBMCService</span><span class="pun">,</span><span class="pln"> error</span><span class="pun">);</span><span class="pln">
+      startBtn</span><span class="pun">.</span><span class="pln">disabled </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">true</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">
+      debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;Service Discovery API not supported!"</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">function</span><span class="pln"> gotXBMCService</span><span class="pun">(</span><span class="pln">services</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+
+</span><span class="com">// Listen for service disconnect messages</span><span class="pln">
+
+   services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'readystatechange'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln"> e </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+     </span><span class="kwd">if</span><span class="pun">(</span><span class="pln">services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">readyState </span><span class="pun">===</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">UNAVAILABLE</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+       debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">" disconnected."</span><span class="pun">;</span><span class="pln">
+       startBtn</span><span class="pun">.</span><span class="pln">disabled </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">false</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">// Send a service message to get albums list (and process the service response)</span><span class="pln">
+
+   </span><span class="kwd">var</span><span class="pln"> svcXhr </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">XMLHttpRequest</span><span class="pun">();</span><span class="pln">
+   svcXhr</span><span class="pun">.</span><span class="pln">open</span><span class="pun">(</span><span class="str">"POST"</span><span class="pun">,</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">url </span><span class="pun">+</span><span class="pln"> </span><span class="str">"/getAlbums"</span><span class="pun">);</span><span class="pln"> </span><span class="com">// services[0].url and its subresources have been</span><span class="pln">
+                                                        </span><span class="com">// whitelisted for cross-site XHR use in this</span><span class="pln">
+                                                        </span><span class="com">// current browsing context.</span><span class="pln">
+
+   svcXhr</span><span class="pun">.</span><span class="pln">setRequestHeader</span><span class="pun">(</span><span class="str">'Content-Type'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'application/json-rpc'</span><span class="pun">);</span><span class="pln">
+
+   svcXhr</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'readystatechange'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln"> response </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+     </span><span class="kwd">if</span><span class="pun">(</span><span class="pln"> response</span><span class="pun">.</span><span class="pln">readyState </span><span class="pun">!=</span><span class="pln"> </span><span class="lit">4</span><span class="pln"> </span><span class="pun">||</span><span class="pln"> response</span><span class="pun">.</span><span class="pln">status </span><span class="pun">!=</span><span class="pln"> </span><span class="lit">200</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">
+     debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">" response received: "</span><span class="pun">;</span><span class="pln">
+     debug</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">+=</span><span class="pln"> JSON</span><span class="pun">.</span><span class="pln">parse</span><span class="pun">(</span><span class="pln">response</span><span class="pun">.</span><span class="pln">responseText</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="kwd">var</span><span class="pln"> svcMsg </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="str">"jsonrpc"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2.0"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"method"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"AudioLibrary.GetAlbums"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"params"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"genreid"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">-</span><span class="lit">1</span><span class="pun">,</span><span class="pln">
+         </span><span class="str">"artistid"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">-</span><span class="lit">1</span><span class="pun">,</span><span class="pln"> </span><span class="str">"start"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">-</span><span class="lit">1</span><span class="pun">,</span><span class="pln"> </span><span class="str">"end"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">-</span><span class="lit">1</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">}</span><span class="pln">
+   </span><span class="pun">];</span><span class="pln">
+
+   svcXhr</span><span class="pun">.</span><span class="pln">send</span><span class="pun">(</span><span class="pln">JSON</span><span class="pun">.</span><span class="pln">stringify</span><span class="pun">(</span><span class="pln">svcMsg</span><span class="pun">));</span><span class="pln">
+   debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">" request sent: "</span><span class="pun">;</span><span class="pln">
+   debug</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">+=</span><span class="pln"> JSON</span><span class="pun">.</span><span class="pln">stringify</span><span class="pun">(</span><span class="pln">svcMsg</span><span class="pun">);</span><span class="pln">
+
+ </span><span class="pun">}</span><span class="pln">
+
+ </span><span class="kwd">function</span><span class="pln"> error</span><span class="pun">(</span><span class="pln"> err </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+   debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;An error occurred obtaining a local network service."</span><span class="pun">;</span><span class="pln">
+   startBtn</span><span class="pun">.</span><span class="pln">disabled </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">;</span><span class="pln">
+ </span><span class="pun">}</span><span class="pln">
+</span><span class="tag">&lt;/script&gt;</span></pre>
+           </div>
+
+           <div class="example">
+            <p>
+             This sample exposes a drop-down list containing a number of common Home-based audio devices. When the user selects an audio device from the list provided, they are prompted to authorize a network service
+             based on the service type requested. The user may also select multiple network services matching the selected service type.
+             In this example, the user selects their make as being <var>Sony</var> and their model as being <var>Bravia S1000</var> from which the Web page can derive a service type
+             (<var>urn:schemas-upnp-org:service:RenderingControl:1</var>).
+             <br><br>Once the user has authorized the device, the web page sends a simple mute command according to the messaging format supported by the device.
+            </p>
+            <hr>
+            <pre class="highlight prettyprint"><span class="tag">&lt;select</span><span class="pln"> </span><span class="atn">name</span><span class="pun">=</span><span class="atv">"make"</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"make"</span><span class="tag">&gt;</span><span class="pln">
+  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">selected</span><span class="pun">=</span><span class="atv">"selected"</span><span class="pln"> </span><span class="atn">disabled</span><span class="pun">=</span><span class="atv">"disabled"</span><span class="tag">&gt;</span><span class="pln">Select make</span><span class="tag">&lt;/option&gt;</span><span class="pln">
+  </span><span class="tag">&lt;option&gt;</span><span class="pln">Sony</span><span class="tag">&lt;/option&gt;</span><span class="pln">
+  </span><span class="tag">&lt;option&gt;</span><span class="pln">Philips</span><span class="tag">&lt;/option&gt;</span><span class="pln">
+  </span><span class="tag">&lt;option&gt;</span><span class="pln">Alba</span><span class="tag">&lt;/option&gt;</span><span class="pln">
+</span><span class="tag">&lt;/select&gt;</span><span class="pln">
+</span><span class="tag">&lt;select</span><span class="pln"> </span><span class="atn">name</span><span class="pun">=</span><span class="atv">"model"</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"model"</span><span class="tag">&gt;&lt;/select&gt;</span><span class="pln">
+</span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"debugconsole"</span><span class="tag">&gt;&lt;/div&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"> debug </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">'debugconsole'</span><span class="pun">);</span><span class="pln">
+
+  </span><span class="kwd">var</span><span class="pln"> models </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+    </span><span class="str">"Sony"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="pln">
+      </span><span class="pun">{</span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"Bravia TV S1000"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"type"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"upnp"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"service"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"urn:schemas-upnp-org:service:RenderingControl:1"</span><span class="pln"> </span><span class="pun">},</span><span class="pln">
+      </span><span class="pun">{</span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"Bravia TV S2000"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"type"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"zeroconf"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"service"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"_mediarenderer._http._tcp"</span><span class="pln"> </span><span class="pun">},</span><span class="pln">
+      </span><span class="pun">{</span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"HiFi WD10"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"type"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"upnp"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"service"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"urn:schemas-upnp-org:service:RenderingControl:1"</span><span class="pln"> </span><span class="pun">}</span><span class="pln">
+    </span><span class="pun">],</span><span class="pln">
+    </span><span class="str">"Philips"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="pln"> </span><span class="com">/* ... */</span><span class="pln"> </span><span class="pun">],</span><span class="pln">
+    </span><span class="str">"Alba"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="pln"> </span><span class="com">/* ... */</span><span class="pln"> </span><span class="pun">]</span><span class="pln">
+  </span><span class="pun">};</span><span class="pln">
+
+  </span><span class="kwd">var</span><span class="pln"> makeEl </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">"make"</span><span class="pun">),</span><span class="pln">
+      modelEl </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">"model"</span><span class="pun">);</span><span class="pln">
+
+  makeEl</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">
+    modelEl</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">=</span><span class="pln"> </span><span class="str">""</span><span class="pun">;</span><span class="pln"> </span><span class="com">// reset</span><span class="pln">
+    </span><span class="kwd">var</span><span class="pln"> defaultOption </span><span class="pun">=</span><span class="pln"> document</span><span class="pun">.</span><span class="pln">createElement</span><span class="pun">(</span><span class="str">"option"</span><span class="pun">);</span><span class="pln">
+    defaultOption</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">=</span><span class="pln"> </span><span class="str">"Select model"</span><span class="pun">;</span><span class="pln">
+    defaultOption</span><span class="pun">.</span><span class="pln">setAttribute</span><span class="pun">(</span><span class="str">"disabled"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"disabled"</span><span class="pun">);</span><span class="pln">
+    defaultOption</span><span class="pun">.</span><span class="pln">setAttribute</span><span class="pun">(</span><span class="str">"selected"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"selected"</span><span class="pun">);</span><span class="pln">
+    modelEl</span><span class="pun">.</span><span class="pln">appendChild</span><span class="pun">(</span><span class="pln">defaultOption</span><span class="pun">);</span><span class="pln">
+    </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class="pln"> i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> l </span><span class="pun">=</span><span class="pln"> models</span><span class="pun">[</span><span class="pln">makeEl</span><span class="pun">.</span><span class="pln">value</span><span class="pun">].</span><span class="pln">length</span><span class="pun">;</span><span class="pln"> i </span><span class="pun">&lt;</span><span class="pln"> l</span><span class="pun">;</span><span class="pln"> i</span><span class="pun">++)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+      </span><span class="kwd">var</span><span class="pln"> option </span><span class="pun">=</span><span class="pln"> document</span><span class="pun">.</span><span class="pln">createElement</span><span class="pun">(</span><span class="str">"option"</span><span class="pun">);</span><span class="pln">
+      option</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">=</span><span class="pln"> models</span><span class="pun">[</span><span class="pln">makeEl</span><span class="pun">.</span><span class="pln">value</span><span class="pun">][</span><span class="pln">i</span><span class="pun">][</span><span class="str">"name"</span><span class="pun">];</span><span class="pln">
+      option</span><span class="pun">.</span><span class="pln">setAttribute</span><span class="pun">(</span><span class="str">"value"</span><span class="pun">,</span><span class="pln"> models</span><span class="pun">[</span><span class="pln">makeEl</span><span class="pun">.</span><span class="pln">value</span><span class="pun">][</span><span class="pln">i</span><span class="pun">][</span><span class="str">"type"</span><span class="pun">]</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class="str">":"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> models</span><span class="pun">[</span><span class="pln">makeEl</span><span class="pun">.</span><span class="pln">value</span><span class="pun">][</span><span class="pln">i</span><span class="pun">][</span><span class="str">"service"</span><span class="pun">]);</span><span class="pln">
+      modelEl</span><span class="pun">.</span><span class="pln">appendChild</span><span class="pun">(</span><span class="pln">option</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">
+
+  modelEl</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="pun">(</span><span class="pln">navigator</span><span class="pun">.</span><span class="pln">getNetworkServices </span><span class="pun">&amp;&amp;</span><span class="pln">
+         modelEl</span><span class="pun">.</span><span class="pln">value </span><span class="pun">==</span><span class="pln"> </span><span class="str">"upnp:urn:schemas-upnp-org:service:RenderingControl:1"</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">getNetworkServices</span><span class="pun">(</span><span class="pln">modelEl</span><span class="pun">.</span><span class="pln">value</span><span class="pun">,</span><span class="pln"> successCallback</span><span class="pun">,</span><span class="pln"> errorCallback</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="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">modelEl</span><span class="pun">.</span><span class="pln">value </span><span class="pun">==</span><span class="pln"> </span><span class="str">"zeroconf:_mediarenderer._http._tcp"</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+      debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;Service type is not implemented by this application."</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">
+      debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;Service Discovery is not supported!"</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="tag">&lt;/script&gt;</span><span class="pln">
+
+</span><span class="tag">&lt;script&gt;</span><span class="pln">
+  </span><span class="kwd">function</span><span class="pln"> successCallback</span><span class="pun">(</span><span class="pln"> services </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+
+  </span><span class="com">// Listen for service push messages</span><span class="pln">
+
+    services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'message'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln"> msg </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+         debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">" event received: "</span><span class="pun">;</span><span class="pln">
+         debug</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">+=</span><span class="pln"> msg</span><span class="pun">.</span><span class="pln">data</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">// Send a control signal to mute the service audio</span><span class="pln">
+
+    </span><span class="kwd">var</span><span class="pln"> svcXhr </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">XMLHttpRequest</span><span class="pun">();</span><span class="pln">
+    svcXhr</span><span class="pun">.</span><span class="pln">open</span><span class="pun">(</span><span class="str">"POST"</span><span class="pun">,</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">url</span><span class="pun">);</span><span class="pln"> </span><span class="com">// services[0].url and its</span><span class="pln">
+                                          </span><span class="com">// subresources have been whitelisted for</span><span class="pln">
+                                          </span><span class="com">// cross-site XHR use in this current</span><span class="pln">
+                                          </span><span class="com">// browsing context.</span><span class="pln">
+
+    svcXhr</span><span class="pun">.</span><span class="pln">setRequestHeader</span><span class="pun">(</span><span class="str">'SOAPAction'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'urn:schemas-upnp-org:service:RenderingControl:1#SetMute'</span><span class="pun">);</span><span class="pln">
+    svcXhr</span><span class="pun">.</span><span class="pln">setRequestHeader</span><span class="pun">(</span><span class="str">'Content-Type'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'text/xml; charset="utf-8";'</span><span class="pun">);</span><span class="pln">
+
+    svcXhr</span><span class="pun">.</span><span class="pln">onreadystatechange </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln"> response </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+      </span><span class="kwd">if</span><span class="pun">(</span><span class="pln"> response</span><span class="pun">.</span><span class="pln">readyState </span><span class="pun">!=</span><span class="pln"> </span><span class="lit">4</span><span class="pln"> </span><span class="pun">||</span><span class="pln"> response</span><span class="pun">.</span><span class="pln">status </span><span class="pun">!=</span><span class="pln"> </span><span class="lit">200</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">
+      debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">" response received: "</span><span class="pun">;</span><span class="pln">
+      debug</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">+=</span><span class="pln"> response</span><span class="pun">.</span><span class="pln">responseXML</span><span class="pun">;</span><span class="pln">
+    </span><span class="pun">}</span><span class="pln">
+
+    </span><span class="com">// Service messaging to mute the provided service</span><span class="pln">
+    </span><span class="kwd">var</span><span class="pln"> svcMsg </span><span class="pun">=</span><span class="pln"> </span><span class="str">'&lt;?xml version="1.0" encoding="utf-8"?&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                 </span><span class="str">'&lt;s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" '</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                   </span><span class="str">'xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                   </span><span class="str">'&lt;s:Body&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                     </span><span class="str">'&lt;u:SetMute xmlns:u="urn:schemas-upnp-org:service:RenderingControl:1"&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                       </span><span class="str">'&lt;InstanceID&gt;0&lt;/InstanceID&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                       </span><span class="str">'&lt;Channel&gt;Master&lt;/Channel&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                       </span><span class="str">'&lt;DesiredMute&gt;true&lt;/DesiredMute&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                     </span><span class="str">'&lt;/u:SetMute&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                   </span><span class="str">'&lt;/s:Body&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                 </span><span class="str">'&lt;/s:Envelope&gt;'</span><span class="pun">;</span><span class="pln">
+
+    svcXhr</span><span class="pun">.</span><span class="pln">send</span><span class="pun">(</span><span class="pln">svcMsg</span><span class="pun">);</span><span class="pln">
+    debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">" request sent: "</span><span class="pun">;</span><span class="pln">
+    debug</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">+=</span><span class="pln"> svcMsg</span><span class="pun">;</span><span class="pln">
+  </span><span class="pun">}</span><span class="pln">
+
+  </span><span class="kwd">function</span><span class="pln"> errorCallback</span><span class="pun">(</span><span class="pln"> error </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+    debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;An error occurred: "</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> error</span><span class="pun">.</span><span class="pln">code</span><span class="pun">;</span><span class="pln">
+  </span><span class="pun">}</span><span class="pln">
+</span><span class="tag">&lt;/script&gt;</span></pre>
+          </div>
+
+       </section>
+
+    <section id="acknowledgements">
+      <!--OddPage--><h2><span class="secno">B. </span>Acknowledgements</h2>
+
+      <p>Thanks are expressed by the editor to the following individuals for their feedback on this specification to date (in alphabetical order):
+      <br><br>
+      Gar Bergstedt, Lars-Erik Bolstad, Hari G Kumar, Bob Lund, Giuseppe Pascale, Marcin Simonides, Clarke Stevens, Christian Söderström, Mark Vickers, ...</p>
+
+      <p>Thanks are also expressed by the editor to the following organizations and groups for their support in producing this specification to date (in alphabetical order):
+      <br><br>
+      CableLabs, Opera Software ASA, <abbr title="World Wide Web Consortium">W3C</abbr> Device APIs Working Group, <abbr title="World Wide Web Consortium">W3C</abbr> Web and TV Interest Group, ...</p>
+    </section>
+
+
+<section class="appendix" id="references"><!--OddPage--><h2><span class="secno">C. </span>References</h2><section id="normative-references"><h3><span class="secno">C.1 </span>Normative references</h3><dl class="bibliography"><dt id="bib-DNS-SD">[DNS-SD]</dt><dd>S. Cheshire; M. Krochmal. <a href="http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt"><cite>DNS-Based Service Discovery.</cite></a> 27 February 2011. IETF Draft. URL: <a href="http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt">http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt</a>
+</dd><dt id="bib-DOM4">[DOM4]</dt><dd>Anne van Kesteren; Aryeh Gregor; Ms2ger. <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html/"><cite>DOM4.</cite></a> URL: <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html/">http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html/</a> 
+</dd><dt id="bib-HTML5">[HTML5]</dt><dd>Ian Hickson; David Hyatt. <a href="http://www.w3.org/TR/html5"><cite>HTML5.</cite></a> 25 May 2011. 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-MDNS">[MDNS]</dt><dd>S. Cheshire; M. Krochmal. <a href="http://files.multicastdns.org/draft-cheshire-dnsext-multicastdns.txt"><cite>Multicast DNS.</cite></a> 14 February 2011. IETF Draft. URL: <a href="http://files.multicastdns.org/draft-cheshire-dnsext-multicastdns.txt">http://files.multicastdns.org/draft-cheshire-dnsext-multicastdns.txt</a>
+</dd><dt id="bib-POSTMSG">[POSTMSG]</dt><dd>Ian Hickson. <a href="http://dev.w3.org/html5/postmsg"><cite>HTML5 Web Messaging.</cite></a> URL: <a href="http://dev.w3.org/html5/postmsg">http://dev.w3.org/html5/postmsg</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-UPNP-DEVICEARCH11">[UPNP-DEVICEARCH11]</dt><dd><a href="http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf"><cite>UPnP Device Architecture 1.1</cite></a>. 15 October 2008. UPnP Forum. PDF document. URL: <a href="http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf">http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf</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><dt id="bib-ZEROCONF">[ZEROCONF]</dt><dd>S. Cheshire; B. Aboba; E. Guttman. <a href="http://files.zeroconf.org/rfc3927.txt"><cite>Dynamic Configuration of IPv4 Link-Local Addresses.</cite></a> May 2005. IETF Draft. URL: <a href="http://files.zeroconf.org/rfc3927.txt">http://files.zeroconf.org/rfc3927.txt</a>
+</dd></dl></section><section id="informative-references"><h3><span class="secno">C.2 </span>Informative references</h3><p>No informative references.</p></section></section></body></html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/discovery-api/Overview.html	Mon Sep 03 15:35:05 2012 +0200
@@ -0,0 +1,1809 @@
+<!DOCTYPE html>
+<html lang="en" dir="ltr">
+<head>
+    <title>Networked Service Discovery and Messaging</title>
+    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+
+
+
+    <style type="text/css">
+      /* Custom CSS optimizations (Richard Tibbett) */
+
+      /* Add better spacing to sections */
+      section, .section { margin-bottom: 2em; }
+
+      /* Reduce note & issue render size */
+      .note, .issue { font-size:0.8em; }
+
+      /* Add addition spacing to <ol> and <ul> for rule definition */
+      ol.rule li, ul.rule li { padding:0.6em; }
+
+      pre.widl { border: solid thin; background: #EEEEEE; color: black; padding: 0.5em 1em; position: relative; }
+      pre.widl :link, pre.widl :visited { color: #000; background: transparent; }
+      pre.widl:before { content: "IDL"; font: bold small sans-serif; padding: 0.5em; background: white; position: absolute; top: 0; margin: -1px 0 0 -4em; width: 1.5em; border: thin solid; border-radius: 0 0 0 0.5em }
+
+      div.example { border: solid thin red; background: #F7DFE5; color: black; padding: 0.5em 1em; position: relative; margin: 1em 0 1em 4.6em; width: auto; }
+      div.example:before { content: "EXAMPLE"; font: bold small sans-serif; padding: 0.5em; background: red; color: white; position: absolute; top: 0; margin: -1px 0 0 -7.6em; width: 5em; border: thin solid red; border-radius: 0 0 0 0.5em }
+
+      dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
+      hr + dl.domintro, div.impl + dl.domintro { margin-top: 2.5em; margin-bottom: 1.5em; }
+      dl.domintro dt, dl.domintro dt * { color: black; text-decoration: none; }
+      dl.domintro dd { margin: 0.5em 0 1em 2em; padding: 0; }
+      dl.domintro dd p { margin: 0.5em 0; }
+      dl.domintro code {font-size: inherit; font-style: italic; }
+      dl.domintro:before { display: table; margin: -1em -0.5em 0.5em auto; width: auto; content: 'This box is non-normative. Implementation requirements are given below this box.'; color: red; border: solid 2px; background: white; padding: 0 0.25em; }
+    </style>
+  <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>/* --- 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><link rel="stylesheet" href="http://www.w3.org/StyleSheets/TR/W3C-ED"><!--[if lt IE 9]><script src='undefined://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">Networked Service Discovery and Messaging</h1>
+
+  <h2 id="w3c-editor-s-draft-22-august-2012"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft 22 August 2012</h2>
+  <dl>
+
+      <dt>This version:</dt>
+      <dd><a href="http://w3c-test.org/dap/discovery-api/">http://w3c-test.org/dap/discovery-api/</a></dd>
+      <dt>Latest published version:</dt>
+      <dd><a href="http://www.w3.org/TR/discovery-api/">http://www.w3.org/TR/discovery-api/</a></dd>
+
+
+      <dt>Latest editor's draft:</dt>
+      <dd><a href="http://w3c-test.org/dap/discovery-api/">http://w3c-test.org/dap/discovery-api/</a></dd>
+
+
+
+
+
+
+
+
+    <dt>Editors:</dt>
+    <dd><span>Rich Tibbett</span>, <a href="http://opera.com/">Opera Software ASA</a></dd>
+<dd><span>Clarke Stevens</span>, <a href="http://cablelabs.com/">CableLabs</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>
+        This specification defines a mechanism for an HTML document to discover and subsequently communicate with <abbr title="Hypertext Transfer Protocol">HTTP</abbr>-based services
+        advertised via common discovery protocols within a user's network.
+      </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>
+        This document represents the early consensus of the group on the scope and features of the proposed
+        <abbr title="Application Programming Interface">API</abbr>.
+      </p>
+
+        <p>
+          This document was published by the <a href="http://www.w3.org/2009/dap/">Device APIs and Policy Working Group</a> as an Editor's Draft.
+
+          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 an Editor's 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></li><li class="tocline"><a href="#conformance" class="tocxref"><span class="secno">2. </span>Conformance</a><ul class="toc"><li class="tocline"><a href="#dependencies" class="tocxref"><span class="secno">2.1 </span>Dependencies</a></li></ul></li><li class="tocline"><a href="#terminology" class="tocxref"><span class="secno">3. </span>Terminology</a></li><li class="tocline"><a href="#requesting-networked-services" class="tocxref"><span class="secno">4. </span>Requesting networked services</a><ul class="toc"><li class="tocline"><a href="#methods" class="tocxref"><span class="secno">4.1 </span>Methods</a></li><li class="tocline"><a href="#error-handling" class="tocxref"><span class="secno">4.2 </span>Error Handling</a></li></ul></li><li class="tocline"><a href="#obtaining-networked-services" class="tocxref"><span class="secno">5. </span>Obtaining networked services</a><ul class="toc"><li class="tocline"><a href="#attributes" class="tocxref"><span class="secno">5.1 </span>Attributes</a></li><li class="tocline"><a href="#methods-1" class="tocxref"><span class="secno">5.2 </span>Methods</a></li><li class="tocline"><a href="#events" class="tocxref"><span class="secno">5.3 </span>Events</a></li></ul></li><li class="tocline"><a href="#communicating-with-a-networked-service" class="tocxref"><span class="secno">6. </span>Communicating with a networked service</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="#states" class="tocxref"><span class="secno">6.2 </span>States</a></li><li class="tocline"><a href="#events-1" class="tocxref"><span class="secno">6.3 </span>Events</a></li></ul></li><li class="tocline"><a href="#service-discovery" class="tocxref"><span class="secno">7. </span>Service Discovery</a><ul class="toc"><li class="tocline"><a href="#zeroconf-mdns-dns-sd" class="tocxref"><span class="secno">7.1 </span>Zeroconf (<abbr title="Multicast DNS">mDNS</abbr> + <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr>)</a></li><li class="tocline"><a href="#universal-plug-and-play-upnp" class="tocxref"><span class="secno">7.2 </span>Universal Plug-and-Play (<abbr title="Universal Plug-and-Play">UPnP</abbr>)</a></li><li class="tocline"><a href="#network-topology-monitoring" class="tocxref"><span class="secno">7.3 </span>Network Topology Monitoring</a></li></ul></li><li class="tocline"><a href="#garbage-collection" class="tocxref"><span class="secno">8. </span>Garbage collection</a></li><li class="tocline"><a href="#use-cases-and-requirements" class="tocxref"><span class="secno">9. </span>Use Cases and Requirements</a></li><li class="tocline"><a href="#examples" class="tocxref"><span class="secno">A. </span>Examples</a></li><li class="tocline"><a href="#acknowledgements" class="tocxref"><span class="secno">B. </span>Acknowledgements</a></li><li class="tocline"><a href="#references" class="tocxref"><span class="secno">C. </span>References</a><ul class="toc"><li class="tocline"><a href="#normative-references" class="tocxref"><span class="secno">C.1 </span>Normative references</a></li><li class="tocline"><a href="#informative-references" class="tocxref"><span class="secno">C.2 </span>Informative references</a></li></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>To enable Web pages to connect and communicate with Local-networked Services provided over <abbr title="Hypertext Transfer Protocol">HTTP</abbr>, this specification introduces the
+      <a href="#navigatornetworkservice"><code>NavigatorNetworkService</code></a> interface.</p>
+
+      <p>
+         Using this <abbr title="Application Programming Interface">API</abbr> consists of requesting a well-known service type, known by developers and advertised by Local-networked Devices. User authorization, where the user connects the web page to one or more discovered services,
+         is expected before the web page is able to interact with any Local-networked Services.
+      </p>
+
+      <p>
+         A web page creates a request to obtain connectivity to services running in the network by specifying a well-known discovery service type that it wishes to interact with.
+      </p>
+
+      <p>
+         The user agent, having captured all advertised services on the network from the Service Discovery mechanisms included in this recommendation, attempts to match
+      the requested service type to a discovered service according to the processing described herein.
+      </p>
+
+      <p>
+          If a service connectivity request is successful then the Web page is provided with the necessary information to communicate with the authorized Local-networked Service.
+          If the request fails then the Web page will receive an error callback containing an error code describing the cause of Local-networked Service connectivity failure.
+      </p>
+
+      <p>
+         Once connected to a Local-networked Service the Web page can send requests and receive responses to the Local-networked Service via the messaging format and appropriate channel inferred from the service type
+         authorized via the provided <abbr title="Application Programming Interface">API</abbr>.
+         The Web page, once connected, can also receive service-pushed events, in the messaging format supported by the Local-networked Device, if such event subscription functionality is provided by the
+         connected Local-networked Service.
+      </p>
+
+      <div class="example">
+       <p>Example of requesting a <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr> advertised service:</p>
+       <hr>
+       <pre class="highlight prettyprint"><span class="kwd">function</span><span class="pln"> showServices</span><span class="pun">(</span><span class="pln"> services </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+  </span><span class="com">// Show a list of all the services provided to the web page</span><span class="pln">
+  </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class="pln"> i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> l </span><span class="pun">=</span><span class="pln"> services</span><span class="pun">.</span><span class="pln">length</span><span class="pun">;</span><span class="pln"> i </span><span class="pun">&lt;</span><span class="pln"> l</span><span class="pun">;</span><span class="pln"> i</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"> services</span><span class="pun">[</span><span class="pln">i</span><span class="pun">].</span><span class="pln">name </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">getNetworkServices</span><span class="pun">(</span><span class="str">'zeroconf:_boxee-jsonrpc._tcp'</span><span class="pun">,</span><span class="pln"> showServices</span><span class="pun">);</span></pre>
+      </div>
+
+      <div class="example">
+        <p>Example of requesting a <abbr title="Universal Plug-and-Play">UPnP</abbr> advertised service, also handling error conditions:</p>
+        <hr>
+        <pre class="highlight prettyprint"><span class="kwd">function</span><span class="pln"> showServices</span><span class="pun">(</span><span class="pln"> services </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+  </span><span class="com">// Show a list of all the services provided to the web page</span><span class="pln">
+  </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class="pln"> i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> l </span><span class="pun">=</span><span class="pln"> services</span><span class="pun">.</span><span class="pln">length</span><span class="pun">;</span><span class="pln"> i </span><span class="pun">&lt;</span><span class="pln"> l</span><span class="pun">;</span><span class="pln"> i</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"> services</span><span class="pun">[</span><span class="pln">i</span><span class="pun">].</span><span class="pln">name </span><span class="pun">);</span><span class="pln">
+</span><span class="pun">}</span><span class="pln">
+
+</span><span class="kwd">function</span><span class="pln"> error</span><span class="pun">(</span><span class="pln"> e </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"> </span><span class="str">"Error occurred: "</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> e</span><span class="pun">.</span><span class="pln">code </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">getNetworkServices</span><span class="pun">(</span><span class="str">'upnp:urn:schemas-upnp-org:service:ContentDirectory:1'</span><span class="pun">,</span><span class="pln"> showServices</span><span class="pun">,</span><span class="pln"> error</span><span class="pun">);</span></pre>
+      </div>
+
+      <div class="example">
+        <p>Example of requesting either a <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr> or <abbr title="Universal Plug-and-Play">UPnP</abbr> advertised service:</p>
+        <hr>
+        <pre class="highlight prettyprint"><span class="kwd">function</span><span class="pln"> showServices</span><span class="pun">(</span><span class="pln"> services </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+  </span><span class="com">// Show a list of all the services provided to the web page (+ service type)</span><span class="pln">
+  </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class="pln"> i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> l </span><span class="pun">=</span><span class="pln"> services</span><span class="pun">.</span><span class="pln">length</span><span class="pun">;</span><span class="pln"> i </span><span class="pun">&lt;</span><span class="pln"> l</span><span class="pun">;</span><span class="pln"> i</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"> services</span><span class="pun">[</span><span class="pln">i</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">'('</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="pln">i</span><span class="pun">].</span><span class="pln">type </span><span class="pun">+</span><span class="pln"> </span><span class="str">')'</span><span class="pln"> </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">getNetworkServices</span><span class="pun">([</span><span class="pln">
+  </span><span class="str">'zeroconf:_boxee-jsonrpc._tcp'</span><span class="pun">,</span><span class="pln">
+  </span><span class="str">'upnp:urn:schemas-upnp-org:service:ContentDirectory:1'</span><span class="pln">
+</span><span class="pun">],</span><span class="pln"> showServices</span><span class="pun">);</span></pre>
+      </div>
+
+      <p>For more detailed examples see the <a href="#examples">Examples</a> section.
+    </p></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>Requirements phrased in the imperative as part of algorithms (such as "strip any leading space characters" or "return false and abort these steps") are to be interpreted with the
+     meaning of the key word ("must", "should", "may", etc) used in introducing the algorithm.</p>
+
+     <p>
+      Some conformance requirements are phrased as requirements on attributes, methods or objects. Such requirements are to be interpreted as requirements on user agents.
+     </p>
+
+     <p>
+      Conformance requirements phrased as algorithms or specific steps may be implemented in any manner, so long as the end result is equivalent. (In particular, the algorithms defined in
+      this specification are intended to be easy to follow, and not intended to be performant.)
+     </p>
+
+     <p>
+      The only conformance class defined by this specification is a <dfn id="dfn-user-agent">user agent</dfn>.
+     </p>
+
+     <p>
+      User agents may impose implementation-specific limits on otherwise unconstrained inputs, e.g. to prevent denial of service attacks, to guard against running out of memory, or to work
+      around platform-specific limitations.
+     </p>
+
+     <p>
+      When support for a feature is disabled (e.g. as an emergency measure to mitigate a security problem, or to aid in development, or for performance reasons), user agents must act as if
+      they had no support for the feature whatsoever, and as if the feature was not mentioned in this specification. For example, if a particular feature is accessed via an attribute in a Web
+      IDL interface, the attribute itself would be omitted from the objects that implement that interface - leaving the attribute on the object but making it return null or throw an exception
+      is insufficient.
+     </p>
+
+      <section id="dependencies">
+         <h3><span class="secno">2.1 </span>Dependencies</h3>
+
+         This specification relies on several other underlying specifications.
+
+         <dl>
+            <dt>HTML</dt>
+            <dd>Many fundamental concepts from HTML are used by this specification. [<cite><a class="bibref" href="#bib-HTML5">HTML5</a></cite>]</dd>
+            <dt>WebIDL</dt>
+            <dd>The IDL blocks in this specification use the semantics of the WebIDL specification. [<cite><a class="bibref" href="#bib-WEBIDL">WEBIDL</a></cite>]</dd>
+         </dl>
+      </section>
+    </section>
+
+    <section id="terminology">
+      <!--OddPage--><h2><span class="secno">3. </span>Terminology</h2>
+
+      <p>
+         The construction "a <code>Foo</code> object", where <code>Foo</code> is actually an interface, is sometimes used instead of the more accurate "an object implementing the interface <code>Foo</code>".
+      </p>
+
+      <p>
+         The term DOM is used to refer to the <abbr title="Application Programming Interface">API</abbr> set made available to scripts in Web applications, and does not necessarily imply the existence of an actual <code>Document</code> object or of any
+         other <code>Node</code> objects as defined in the DOM Core specifications. [<cite><a class="bibref" href="#bib-DOM4">DOM4</a></cite>]
+      </p>
+
+      <p>
+         An IDL attribute is said to be <em>getting</em> when its value is being retrieved (e.g. by author script), and is said to be <em>setting</em> when a new value is assigned to it.
+      </p>
+
+      <p>
+        A <dfn id="dfn-valid-service-type">valid service type</dfn> is a string that begins with <code>upnp:</code> or <code>zeroconf:</code> followed by one or more characters in the ranges U+0021, U+0023 to U+0027, U+002A to U+002B, U+002D to U+002E, U+0030 to U+0039, U+0041 to U+005A, U+005E to U+007E.
+      </p>
+
+      <p>
+        A <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> provided in the <code>type</code> attribute of the <code>getNetworkServices()</code> method will be matched against the services currently contained in the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a> according to the algorithms defined in this specification.
+      </p>
+    </section>
+
+    <section id="requesting-networked-services">
+     <!--OddPage--><h2><span class="secno">4. </span>Requesting networked services</h2>
+
+
+<pre class="widl">[Supplemental, NoInterfaceObject]
+interface <dfn id="navigatornetworkservice">NavigatorNetworkService</dfn> {
+  // Obtain a Local-networked Service
+  void <a href="#dom-navigator-getnetworkservices">getNetworkServices</a>( in any type,
+                           in <a href="#navigatornetworkservicesuccesscallback">NavigatorNetworkServiceSuccessCallback</a> successCallback,
+                           in optional <a href="#navigatornetworkserviceerrorcallback">NavigatorNetworkServiceErrorCallback</a> errorCallback );
+};
+<a class="externalDFN" href="http://www.whatwg.org/specs/web-apps/current-work/complete/timers.html#navigator">Navigator</a> implements <a href="#navigatornetworkservice">NavigatorNetworkService</a>;
+
+[Callback=FunctionOnly, NoInterfaceObject]
+interface <dfn id="navigatornetworkservicesuccesscallback">NavigatorNetworkServiceSuccessCallback</dfn> {
+  void handleEvent( in <a href="#networkservices">NetworkServices</a> services );
+};
+
+[NoInterfaceObject]
+interface <dfn id="navigatornetworkserviceerror">NavigatorNetworkServiceError</dfn> {
+  const unsigned short <a href="#dom-navigatornetworkserviceerror-permission_denied">PERMISSION_DENIED_ERR</a> = 1;
+  const unsigned short <a href="#dom-navigatornetworkserviceerror-unknown_type_prefix">UNKNOWN_TYPE_PREFIX_ERR</a> = 2;
+  readonly attribute unsigned short <a href="#dom-navigatornetworkserviceerror-code">code</a>;
+};
+
+[Callback=FunctionOnly, NoInterfaceObject]
+interface <dfn id="navigatornetworkserviceerrorcallback">NavigatorNetworkServiceErrorCallback</dfn> {
+  void handleEvent( in <a href="#navigatornetworkserviceerror">NavigatorNetworkServiceError</a> error );
+};
+</pre>
+
+  <section id="methods">
+   <h3><span class="secno">4.1 </span>Methods</h3>
+
+      <dl class="domintro">
+        <dt>
+          <var title="">window</var>
+           .
+          <code title="dom-navigator">
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/timers.html#navigator">navigator</a>
+          </code>
+           .
+          <code title="dom-navigator-getNetworkServices">
+            <a href="#dom-navigator-getnetworkservices">getNetworkServices</a>
+          </code>
+          (
+          <var title="">type</var>
+          ,
+          <var title="">successCallback</var>
+           [,
+          <var title="">errorCallback</var>
+           ] )
+        </dt>
+        <dd>
+          <p>Prompts the user to select one or more discovered network services that have advertised support for the requested service type.</p>
+          <p>
+            The
+            <var title="">type</var>
+             argument contains one or more <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens that the web page would like to interact with.
+          </p>
+          <p>
+            If the user accepts, the
+            <var title="">successCallback</var>
+             is
+          invoked, with one or more
+            <code>
+              <a href="#networkservice"><code>NetworkService</code></a>
+            </code>
+             objects as
+          its argument.
+          </p>
+          <p>
+            If the user declines, the
+            <var title="">errorCallback</var>
+             (if
+          any) is invoked.
+          </p>
+        </dd>
+      </dl>
+
+       <div>
+          <p>
+            When the <dfn id="dom-navigator-getnetworkservices" title="dom-navigator-getnetworkservices"><code>getNetworkServices(type, successCallback[, errorCallback])</code></dfn> method is called, the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> run the following steps:
+          </p>
+
+          <ol class="rule">
+
+            <li>
+              Let <var>requested control types</var> be initially set to an empty array.
+            </li>
+
+            <li>
+               If <var>type</var> is an array consisting of one or more <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens, then let <var>requested control types</var> by the value of <var>type</var>, removing any non-<a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens from the resulting array.
+            </li>
+
+            <li>
+               If <var>type</var> is a string consisting of one <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> token, then let <var>requested control types</var> be an array containing one item with a value of <var>type</var>.
+            </li>
+
+            <li>
+               If <var>requested control types</var> is an array that contains at least one or more <a title="valid service type" href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens then continue to the step labeled <em>process</em> below. Otherwise, the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose
+                 <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 2
+                  (<a href="#dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></a>) as its argument,
+                   abort any remaining steps and return.
+            </li>
+
+            <li>
+               <em>Process</em>: Let <var>services found</var> be an empty array.
+            </li>
+
+            <li>
+               For each <var>available service</var> in the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a> run the following steps:
+               <ol class="rule">
+                  <li>
+                    For each <var>requested control type</var> in <var>requested control types</var>: If <var>available service</var>'s <code>type</code> attribute equals the <var>requested control type</var> then let <var>matched service</var> equal the value of <var>available service</var> and continue at the step labeled <var>attach</var> below.
+                  </li>
+                  <li>
+                     Continue at the next <var>available service</var>.
+                  </li>
+                  <li>
+                     <em>Attach</em>: If <var>matched service</var> is not empty then run the following steps:
+
+                     <ol class="rule">
+                        <li>
+                           Let <var>new service object</var> be a new <a href="#networkservice"><code>NetworkService</code></a> object, mapping the parameters of
+                     <var>matched service</var> to this new object where possible.
+                        </li>
+                        <li>
+                           Append <var>new service object</var> to the <var>services found</var> array.
+                        </li>
+                     </ol>
+                  </li>
+               </ol>
+            </li>
+
+            <li>
+               If <var>services found</var> is an empty array, then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose
+                 <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1
+                 (<a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its argument, abort any remaining steps and return.
+            </li>
+
+            <li>
+               Return, and run the remaining steps asynchronously.
+            </li>
+
+            <li>
+               Optionally, e.g. based on a previously-established user preference, for security reasons, or due to platform limitations, the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="may">may</em> <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose
+                 <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1
+                 (<a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its argument, abort any remaining steps and return.
+            </li>
+
+            <li>
+                  The <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> prompt the user in a user-agent-specific manner for permission to provide the
+                  <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" class="externalDFN">entry script</a>'s
+                  <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" class="externalDFN">origin</a> with an array of
+                  <a href="#networkservice"><code>NetworkService</code></a> objects representing the user-authorized subset of <var>services found</var>.
+
+               <p>
+                  If the user grants permission to access one or more networked services then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="should">should</em> include an
+                  "ongoing local-network communication" indicator.
+               </p>
+
+               <p>If the user denies permission, then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose
+                <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1
+                (<a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its argument, abort any remaining steps and return.
+              </p>
+
+              <p>
+                If the user never responds, this algorithm stalls on this step.
+              </p>
+
+            </li>
+
+            <li>
+               Let <var>services</var> be the array of one or more <a href="#networkservice"><code>NetworkService</code></a> objects for which the user granted permission.
+            </li>
+
+            <li>
+               For each Object <var>service</var> in <var>services</var>, run the following substeps:
+
+               <ol class="rule">
+                  <li>
+                     Add the <var>service</var>'s <code>url</code> parameter to the <a href="#dfn-entry-script-origin-s-url-whitelist" class="internalDFN">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a>.
+                  </li>
+                  <li>
+                    If <var>service</var>'s <code>type</code> parameter begins with the DOMString "<code>upnp:</code>" and the <var>service</var>'s <code>eventsUrl</code> parameter is not empty then <a href="#dfn-setup-a-upnp-events-subscription" class="internalDFN">setup a <abbr title="Universal Plug-and-Play">UPnP</abbr> Events Subscription</a> for <var>service</var>.
+                  </li>
+               </ol>
+            </li>
+
+            <li>
+               Let <var>services manager</var> be a new <a href="#networkservices"><code>NetworkServices</code></a> object.
+            </li>
+
+            <li>
+               Set <var>services manager</var>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute to the length of <var>services</var>.
+            </li>
+
+            <li>
+              Store the set of <var>services</var> as <dfn id="current_authorized_services">current authorized services</dfn> internally against the newly created <var>services manager</var> object.
+            </li>
+
+            <li>
+               The <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>successCallback</var> with
+               <var>services manager</var> as its argument.
+            </li>
+
+          </ol>
+
+          <p>
+            The <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#task-source" class="externalDFN">task source</a> for these
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#concept-task" class="externalDFN">tasks</a> is the
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#user-interaction-task-source" class="externalDFN">user interaction task source</a>.
+          </p>
+
+          <p>
+            When a <a href="#networkservice"><code>NetworkService</code></a> object is provided to a Web page, the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> add the <code>url</code> property
+             to the <dfn id="dfn-entry-script-origin-s-url-whitelist">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</dfn>. This list enables the
+            Web page to override and initiate cross-site resource requests towards these URLs, and any sub-resources of these URLs, within the current
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" class="externalDFN">entry script</a>'s
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" class="externalDFN">origin</a> via various existing mechanisms (e.g. Web Sockets, Server-Sent Events,
+            Web Messaging, XMLHttpRequest).
+         </p>
+
+         <p>
+            If the user navigates away from the current browsing context, the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> remove all previously whitelisted urls from the <a href="#dfn-entry-script-origin-s-url-whitelist" class="internalDFN">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a>.
+            There is no persistence to network service selections provided to a web page. It is not possible to access a previously white-listed networked service without the necessary user authorization in all of the following cases:
+            </p><ul>
+              <li>If the current script is reloaded at any point in the same or different window.</li>
+              <li>if the current script reinvokes the <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> method at any point in its execution.</li>
+              <li>If the user navigates forward or back in their history to reload the current page.</li>
+              <li>If a script is running in a different origin.</li>
+            </ul>
+         <p></p>
+
+      </div>
+      </section>
+
+      <section id="error-handling">
+         <h3><span class="secno">4.2 </span>Error Handling</h3>
+
+      <dl class="domintro">
+        <dt>
+          <var title="">error</var>
+           .
+          <code title="dom-NavigatorNetworkServiceError-code">
+            <a href="#dom-navigatornetworkserviceerror-code">code</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            Returns the current error's error code. At the current time, this may be <code>1</code> or <code>2</code>, for which the
+            corresponding error constants
+            <a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a> and
+            <a href="#dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></a> are defined.
+          </p>
+        </dd>
+      </dl>
+
+         <p>
+            The <dfn id="dom-navigatornetworkserviceerror-code" title="dom-navigatornetworkserviceerror-code"><code>code</code></dfn> attribute of a
+            <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object <em class="rfc2119" title="must">must</em> return the code for the error, which will be one of the following:
+         </p>
+
+         <dl>
+            <dt>
+               <dfn id="dom-navigatornetworkserviceerror-permission_denied" title="dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></dfn> (numeric value 1)
+            </dt>
+            <dd>
+               The user or user agent denied the page permission to access any services.
+            </dd>
+            <dt>
+               <dfn id="dom-navigatornetworkserviceerror-unknown_type_prefix" title="dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></dfn> (numeric value 2)
+            </dt>
+            <dd>
+               No <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens were provided in the method invocation.
+            </dd>
+         </dl>
+
+      </section>
+
+      </section>
+      <section id="obtaining-networked-services">
+      <!--OddPage--><h2><span class="secno">5. </span>Obtaining networked services</h2>
+
+      <p>
+         The <a href="#networkservices"><code>NetworkServices</code></a> interface is the top-level response object from a call to <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> and provides access to a set of user-authorized <a href="#networkservice"><code>NetworkService</code></a> objects for the given request.
+      </p>
+
+<pre class="widl">[NoInterfaceObject]
+interface <dfn id="networkservices">NetworkServices</dfn> {
+  readonly attribute unsigned long    <a href="#dom-networkservices-length">length</a>;
+  getter <a href="#networkservice">NetworkService</a> (unsigned long index);
+  <a href="#networkservice">NetworkService</a>? <a href="#dom-networkservices-getservicebyid">getServiceById</a>(DOMString id);
+
+  readonly attribute unsigned long    <a href="#dom-networkservices-servicesavailable">servicesAvailable</a>;
+
+  // event handler attributes
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservices-onserviceavailable">onserviceavailable</a>;
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservices-onserviceunavailable">onserviceunavailable</a>;
+
+};
+
+<a href="#networkservices">NetworkServices</a> implements <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-eventtarget" class="externalDFN">EventTarget</a>;
+</pre>
+
+      <section id="attributes">
+      <h3><span class="secno">5.1 </span>Attributes</h3>
+
+        <dl class="domintro">
+          <dt>
+            <code title="dom-networkservices-length">
+              <a href="#dom-networkservices-length">length</a>
+            </code>
+          </dt>
+          <dd>
+            <p>
+              Returns the current number of services in the respective object's <a href="#current_authorized_services" class="internalDFN">current authorized services</a>.
+            </p>
+          </dd>
+          <dt>
+            <code title="dom-networkservices-servicesavailable">
+              <a href="#dom-networkservices-servicesavailable">servicesAvailable</a>
+            </code>
+          </dt>
+          <dd>
+            <p>
+              Returns the current number of services matching one of the app-requested <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens that are actively available within the user's current network.
+            </p>
+          </dd>
+        </dl>
+
+        <div>
+           <p>
+              The <dfn id="dom-networkservices-length"><code>length</code></dfn> attribute <em class="rfc2119" title="must">must</em> return the number of services represented in the object's corresponding <a href="#current_authorized_services" class="internalDFN">current authorized services</a> list at the time of getting.
+           </p>
+
+           <p>
+              The <dfn id="dom-networkservices-servicesavailable"><code>servicesAvailable</code></dfn> attribute <em class="rfc2119" title="must">must</em> return the number of services available in the
+              user's network that match the <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> that was initially used to create the current <a href="#networkservices"><code>NetworkServices</code></a> object.
+           </p>
+
+           <p>
+             When a previously unknown instance of a networked service matching one of the requested <a href="#dfn-valid-service-type">valid service types</a> becomes available on the user's current network, the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> increment the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute by <code>1</code> and then
+             <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a>
+             to dispatch a newly created event with the name <code>serviceavailable</code> that uses the <code>Event</code> interface, which does
+             not bubble, is not cancellable, and has no default action, at the current <a href="#networkservices"><code>NetworkServices</code></a>
+             object.
+           </p>
+
+           <p>
+             When a previously known instance of a networked service matching one of the requested <a href="#dfn-valid-service-type">valid service types</a> becomes unavailable on the user's current network, the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> decrement the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute by <code>1</code> and then
+             <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a>
+              to dispatch a newly created event with the name <code>serviceunavailable</code> that uses the <code>Event</code> interface, which does
+              not bubble, is not cancellable, and has no default action, at the current <a href="#networkservices"><code>NetworkServices</code></a>
+              object.
+           </p>
+        </div>
+
+      </section>
+
+      <section id="methods-1">
+      <h3><span class="secno">5.2 </span>Methods</h3>
+        <dl class="domintro">
+        <dt>
+          <code title="networkservices-getter">
+            <a href="#networkservices">services</a>
+          </code>
+          [
+          <var title="">index</var>
+          ]
+        </dt>
+        <dd>
+          <p>
+            Returns the specified <a href="#networkservice"><code>NetworkService</code></a> object.
+          </p>
+        </dd>
+        <dt>
+          <code title="networkservices-getter">
+            <a href="#networkservices">services</a>
+          </code>
+          .
+          <code title="dom-networkservices-getservicebyid">
+            <a href="#dom-networkservices-getservicebyid">getServiceById</a>
+          </code>
+          (
+          <var title="">id</var>
+          )
+        </dt>
+        <dd>
+          <p>
+            Returns the <a href="#networkservice"><code>NetworkService</code></a> object with the given identifier, or null if no
+            service has that identifier.
+          </p>
+        </dd>
+      </dl>
+
+      <p>
+        A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current list of zero or more <a href="#current_authorized_services" class="internalDFN">current authorized services</a>, of which zero or more can be available at a time. Each item in <a href="#current_authorized_services" class="internalDFN">current authorized services</a> is represented by a <a href="#networkservice"><code>NetworkService</code></a> object. The list of <a href="#current_authorized_services" class="internalDFN">current authorized services</a> is <span>immutable</span> meaning that it cannot be modified for the lifetime of a <a href="#networkservices"><code>NetworkServices</code></a> object.
+      </p>
+
+      <div class="note"><div class="note-title"><span>Note</span></div><p class="">
+        Each service in a <a href="#networkservices"><code>NetworkServices</code></a> object thus has an index; the first has the index 0, and each subsequent service is numbered one higher than the previous one. If the <a href="#dfn-user-agent" class="internalDFN">user agent</a> dynamically adds or removes network services for any reason, then the indices of the services in <a href="#current_authorized_services" class="internalDFN">current authorized services</a> will change dynamically. If the set of network services changes entirely, then all the previous services will be removed from <a href="#current_authorized_services" class="internalDFN">current authorized services</a> and replaced with new services.
+      </p></div>
+
+      <p>
+        The <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#supported-property-indices" class="externalDFN">supported property indices</a> of <a href="#networkservices"><code>NetworkServices</code></a> objects at any instant are the numbers from zero to the number of items in <a href="#current_authorized_services" class="internalDFN">current authorized services</a> represented by the respective object minus one, if any services are represented in <a href="#current_authorized_services" class="internalDFN">current authorized services</a>. If a <a href="#networkservices"><code>NetworkServices</code></a> object represents no <a href="#current_authorized_services" class="internalDFN">current authorized services</a>, it has no <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#supported-property-indices" class="externalDFN">supported property indices</a>.
+      </p>
+
+      <p>
+        To <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#determine-the-value-of-an-indexed-property" class="externalDFN">determine the value of an indexed property</a> for a given index <var>index</var> in a <a href="#networkservices"><code>NetworkServices</code></a> object's <a href="#current_authorized_services" class="internalDFN">current authorized services</a>, the user agent <em class="rfc2119" title="must">must</em> return the <a href="#networkservice"><code>NetworkService</code></a> object that represents the <var>index</var>th service in <a href="#current_authorized_services" class="internalDFN">current authorized services</a>.
+      </p>
+
+      <p>
+        The <dfn id="dom-networkservices-getservicebyid"><code>getServiceById(id)</code></dfn> method <em class="rfc2119" title="must">must</em> return the first <a href="#networkservice"><code>NetworkService</code></a> object in <a href="#current_authorized_services" class="internalDFN">current authorized services</a> represented by the respective object whose <a href="#dom-networkservice-id"><code>id</code></a> attribute is equal to the value of the <var>id</var> argument.
+        When no services in <a href="#current_authorized_services" class="internalDFN">current authorized services</a> match the given argument, the method <em class="rfc2119" title="must">must</em> return null.
+      </p>
+
+      <p>
+         Services available within the local network can connect and disconnect at different times during the execution of a web page. A <a href="#dfn-user-agent" class="internalDFN">user agent</a> can
+         inform a web page when the state of networked services matching the requested <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> change. Web pages can use this information to enable in-page experiences for communicating the state of networked services
+         with the ability to change the particular service or set of services the page is connected to by re-invoking the <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> method.
+      </p>
+
+      </section>
+
+      <section id="events">
+      <h3><span class="secno">5.3 </span>Events</h3>
+
+      <p>
+         The following are the event handlers (and their corresponding event handler event types) that must be supported, as IDL attributes, by all objects implementing the <a href="#networkservices"><code>NetworkServices</code></a> interface:
+       </p>
+
+       <table border="1">
+        <thead>
+          <tr>
+            <th>
+              <span title="event handlers">Event handler</span>
+            </th>
+            <th>
+              <span>Event handler event type</span>
+            </th>
+          </tr>
+        </thead>
+        <tbody>
+          <tr>
+            <td>
+              <dfn id="dom-networkservices-onserviceavailable" title="dom-NetworkServices-onserviceavailable">
+                <code>onserviceavailable</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-serviceavailable">serviceavailable</code>
+            </td>
+          </tr>
+          <tr>
+            <td>
+              <dfn id="dom-networkservices-onserviceunavailable" title="dom-NetworkServices-onserviceunavailable">
+                <code>onserviceunavailable</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-serviceunavailable">serviceunavailable</code>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+
+      <p>
+         Events with an event type of <code>serviceavailable</code> or <code>serviceunavailable</code> defined in this specification are simple <code>Event</code> objects.
+      </p>
+
+      </section>
+
+    </section>
+    <section id="communicating-with-a-networked-service">
+    <!--OddPage--><h2><span class="secno">6. </span>Communicating with a networked service</h2>
+
+<p>
+   The <a href="#networkservice"><code>NetworkService</code></a> interface is used to provide a set of connection information for an <abbr title="Hypertext Transfer Protocol">HTTP</abbr> service endpoint and if available, service events, running on a networked device.
+</p>
+
+<pre class="widl">[NoInterfaceObject]
+interface <dfn id="networkservice">NetworkService</dfn> {
+  readonly attribute DOMString        <a href="#dom-networkservice-id">id</a>;
+  readonly attribute DOMString        <a href="#dom-networkservice-name">name</a>;
+  readonly attribute DOMString        <a href="#dom-networkservice-type">type</a>;
+  readonly attribute DOMString        <a href="#dom-networkservice-url">url</a>;
+  readonly attribute DOMString        <a href="#dom-networkservice-config">config</a>;
+
+  readonly attribute boolean          <a href="#dom-networkservice-online">online</a>;
+
+  // event handler attributes
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservice-onserviceonline">onserviceonline</a>;
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservice-onserviceoffline">onserviceoffline</a>;
+
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservice-onnotify">onnotify</a>;
+};
+
+<a href="#networkservice">NetworkService</a> implements <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-eventtarget" class="externalDFN">EventTarget</a>;
+</pre>
+
+<section id="attributes-1">
+  <h3><span class="secno">6.1 </span>Attributes</h3>
+
+      <dl class="domintro">
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-id">
+            <a href="#dom-networkservice-id">id</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            A unique identifier for the given user-selected service instance.
+          </p>
+        </dd>
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-name">
+            <a href="#dom-networkservice-name">name</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            The name of the user-selected service.
+          </p>
+        </dd>
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-type">
+            <a href="#dom-networkservice-type">type</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            The <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> token value of the user-selected service.
+          </p>
+        </dd>
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-url">
+            <a href="#dom-networkservice-url">url</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            The control <abbr title="Uniform Resource Locator">URL</abbr> endpoint (including any required port information) of the user-selected control service that has been added to the <a href="#dfn-entry-script-origin-s-url-whitelist" class="internalDFN">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a>.
+          </p>
+        </dd>
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-config">
+            <a href="#dom-networkservice-config">config</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            The configuration information associated with the service depending on the requested service type.
+          </p>
+        </dd>
+      </dl>
+
+          <p>
+            The <dfn id="dom-networkservice-id"><code>id</code></dfn> attribute is a unique identifier for the service. The same service provided at different times or on different objects <em class="rfc2119" title="must">must</em> have the same <a href="#dom-networkservice-id"><code>id</code></a> value.
+         </p>
+
+         <p>
+            The <dfn id="dom-networkservice-name"><code>name</code></dfn> attribute represents a human-readable title for the service.
+         </p>
+
+         <p>
+             The <dfn id="dom-networkservice-type"><code>type</code></dfn> attribute reflects the value of the <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> of the service.
+          </p>
+
+         <p>
+            The <dfn id="dom-networkservice-url"><code>url</code></dfn> attribute is an <a href="http://www.w3.org/TR/html5/urls.html#absolute-url" class="externalDFN">absolute <abbr title="Uniform Resource Locator">URL</abbr></a> pointing to the root <abbr title="Hypertext Transfer Protocol">HTTP</abbr>
+            endpoint for the service that has been added to the <a href="#dfn-entry-script-origin-s-url-whitelist" class="internalDFN">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a>. Web pages can subsequently use this value for implicit cross-document messaging via various existing mechanisms (e.g. Web Sockets, Server-Sent Events, Web Messaging, XMLHttpRequest).
+         </p>
+
+         <p>
+            The <dfn id="dom-networkservice-config"><code>config</code></dfn> attribute provides the raw configuration information extracted from the given network service.
+         </p>
+
+      </section>
+
+      <section id="states">
+         <h3><span class="secno">6.2 </span>States</h3>
+
+      <dl class="domintro">
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-online">
+            <a href="#dom-networkservice-online">online</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            Returns <code>true</code> if the service is reporting that it is accessible on the local network or <code>false</code> if the service is reporting that it is no longer accessible (temporarily or permanently) on the local network.
+          </p>
+        </dd>
+      </dl>
+
+      <p>
+        The <dfn id="dom-networkservice-online"><code>online</code></dfn> attribute indicates whether the service is reporting itself as being
+        either <var>online</var>, and therefore accessible on the local network, in which case this attribute will return <code>true</code> or, <var>offline</var>, and therefore not accessible on the local network, either temporarily or permanently, in which case this attribute will return <code>false</code>. This attribute <em class="rfc2119" title="must">must</em> default to <code>true</code>.
+      </p>
+
+      </section>
+
+      <section id="events-1">
+         <h3><span class="secno">6.3 </span>Events</h3>
+
+      <p>
+         The following are the event handlers (and their corresponding event handler event types) that must be supported, as IDL attributes, by all objects implementing the
+         <a href="#networkservice"><code>NetworkService</code></a> interface:
+       </p>
+
+       <table border="1">
+        <thead>
+          <tr>
+            <th>
+              <span title="event handlers">Event handler</span>
+            </th>
+            <th>
+              <span>Event handler event type</span>
+            </th>
+          </tr>
+        </thead>
+        <tbody>
+          <tr>
+            <td>
+              <dfn id="dom-networkservice-onnotify" title="dom-NetworkService-onnotify">
+                <code>onnotify</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-notify">notify</code>
+            </td>
+          </tr>
+          <tr>
+            <td>
+              <dfn id="dom-networkservice-onserviceonline" title="dom-NetworkService-onserviceonline">
+                <code>onserviceonline</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-onserviceonline">serviceonline</code>
+            </td>
+          </tr>
+          <tr>
+            <td>
+              <dfn id="dom-networkservice-onserviceoffline" title="dom-NetworkService-onserviceoffline">
+                <code>onserviceoffline</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-onserviceoffline">serviceoffline</code>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+
+      <p>
+         Events with an event type of <code>notify</code>, <code>serviceonline</code> or <code>serviceoffline</code> defined in this specification are simple <code>Event</code> objects.
+      </p>
+
+      </section>
+   </section>
+
+      <section id="service-discovery">
+            <!--OddPage--><h2><span class="secno">7. </span>Service Discovery</h2>
+
+      <p>
+         A <a href="#dfn-user-agent" class="internalDFN">user agent</a> conforming to this specification <em class="rfc2119" title="may">may</em> implement <acronym title="Simple Service Discovery Protocol">SSDP</acronym> [<cite><a class="bibref" href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>] and Zeroconf [<cite><a class="bibref" href="#bib-DNS-SD">DNS-SD</a></cite>] + [<cite><a class="bibref" href="#bib-MDNS">MDNS</a></cite>] service discovery mechanisms
+         to enable Web pages to request and connect with <abbr title="Hypertext Transfer Protocol">HTTP</abbr> services running on networked devices, discovered via either mechanism, through this <abbr title="Application Programming Interface">API</abbr>. When a <a href="#dfn-user-agent" class="internalDFN">user agent</a> implements either of these service discovery mechanisms, then it <em class="rfc2119" title="must">must</em> conform to the corresponding algorithms provided in this section of the specification.
+      </p>
+      <p>
+         This section presents how the results of these two service discovery
+         mechanisms will be matched to requested service types and how their properties will be applied to any resulting <a href="#networkservice"><code>NetworkService</code></a> objects.
+      </p>
+
+      <p>
+         It is expected that user agents will perform these service discovery mechansisms asynchronously and periodically update the <a>list of networked devices</a> as required. The timing of any
+         service discovery mechanisms is an implementation detail left to the discretion of the implementer (e.g. once on user agent start-up, every X seconds during user agent execution or on
+         invocation of this <abbr title="Application Programming Interface">API</abbr> from a Web page).
+      </p>
+
+      <p>
+         The <dfn id="dfn-list-of-available-service-records">list of available service records</dfn> is a single dynamic internal lookup table within user agents that is used to track the current services available in the network at any given time.
+         At any point during the running of either of the two service discovery mechanisms then existing entries within this table can be updated, entries can be added and entries can be removed as the status of networked
+         services changes. Each record contained within this table contains the attributes: <code>id</code>, <code>name</code>, <code>type</code>, <code>url</code> and <code>config</code>.
+      </p>
+
+            <section id="zeroconf-mdns-dns-sd">
+         <h3><span class="secno">7.1 </span>Zeroconf (<abbr title="Multicast DNS">mDNS</abbr> + <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr>)</h3>
+
+         <p>
+            For each <abbr title="Domain Name System">DNS</abbr> response received from a user-agent-initiated Multicast <abbr title="Domain Name System">DNS</abbr> Browse for <abbr title="DNS Pointer Record">PTR</abbr> records with the name <code>_services._dns-sd._udp</code> on the resolved recommended automatic browsing
+   domain [<cite><a class="bibref" href="#bib-MDNS">MDNS</a></cite>], the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> run the following steps:
+         </p>
+
+         <ol class="rule">
+
+            <li>Let <var>service <abbr title="Multicast DNS">mDNS</abbr> responses</var> be an array of <abbr title="DNS Pointer Record">PTR</abbr> records received by issuing a Multicast <abbr title="Domain Name System">DNS</abbr> Browse for <abbr title="DNS Pointer Record">PTR</abbr> records with the name of the current discovered service type.</li>
+
+            <li>For each Object <var>service <abbr title="Multicast DNS">mDNS</abbr> response</var> in <var>service <abbr title="Multicast DNS">mDNS</abbr> responses</var>, run the following steps:
+               <ol>
+
+                  <li>
+                     Let <var>network service record</var> be an Object consisting of the following empty properties: <code>id</code>, <code>name</code>, <code>type</code>, <code>url</code>, <code>config</code>.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>id</code> property to the value of the full <abbr title="DNS Pointer Record">PTR</abbr> Service Instance Name [<cite><a class="bibref" href="#bib-MDNS">MDNS</a></cite>].
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>name</code> property to the value of the <abbr title="DNS Pointer Record">PTR</abbr> Service Instance Name's <var>Instance</var> component [<cite><a class="bibref" href="#bib-MDNS">MDNS</a></cite>].
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>type</code> property to the concatenation of the string <code>zeroconf:</code> followed by the value of the <abbr title="DNS Pointer Record">PTR</abbr> Service Instance Name's <var>Service</var> component [<cite><a class="bibref" href="#bib-MDNS">MDNS</a></cite>].
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>url</code> property to the resolvable Service <abbr title="Uniform Resource Locator">URL</abbr> obtained from performing an <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr> Lookup [<cite><a class="bibref" href="#bib-DNS-SD">DNS-SD</a></cite>] of the current service from the <abbr title="DNS Pointer Record">PTR</abbr> record provided [<cite><a class="bibref" href="#bib-MDNS">MDNS</a></cite>].
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>config</code> property to the string value of the contents of the first <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr> TXT record associated with the <var>service <abbr title="Multicast DNS">mDNS</abbr> response</var> as defined in [<cite><a class="bibref" href="#bib-DNS-SD">DNS-SD</a></cite>].
+                  </li>
+
+                  <li>
+                     For each Object <var>existing service record</var> in the current <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>, run the following sub-steps:
+                     <ol class="rule">
+
+                       <li>
+                        If the <var>existing service record</var>'s <code>id</code> property matches the value of the <var>network service record</var>'s <code>id</code>, then set the
+                        value of <var>existing service record</var> in the current <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>  to the value of the
+                        <var>network service record</var> and skip the next step.
+                       </li>
+                     </ol>
+                  </li>
+
+                  <li>
+                     Add <var>network service record</var> to the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>.
+                  </li>
+
+                  <li>
+                     For each non-garbage collected <a href="#networkservice"><code>NetworkService</code></a> object run the following steps:
+
+                     <ol class="rule">
+                        <li>
+                           If the <a href="#networkservice"><code>NetworkService</code></a> object's <code>type</code> attribute does not equal the
+                           current <a>network service record</a>'s <code>type</code> property then continue at the next available active
+                           <a href="#networkservice"><code>NetworkService</code></a> object.
+                        </li>
+                        <li>
+                           Increment the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute of the <a href="#networkservices"><code>NetworkServices</code></a> object by <code>1</code>.
+                        </li>
+                        <li>
+                          <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">Queue a task</a>
+                           to dispatch a newly created event with the name <code>serviceavailable</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
+                            <a href="#networkservices"><code>NetworkServices</code></a> object.
+                        </li>
+                        <li>
+                          <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">Queue a task</a>
+                           to dispatch a newly created event with the name <code>serviceonline</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
+                           <a href="#networkservice"><code>NetworkService</code></a> object.
+                        </li>
+                     </ol>
+                  </li>
+            </ol>
+           </li>
+         </ol>
+
+      </section>
+
+      <section id="universal-plug-and-play-upnp">
+         <h3><span class="secno">7.2 </span>Universal Plug-and-Play (<abbr title="Universal Plug-and-Play">UPnP</abbr>)</h3>
+
+         <p>
+            For each <acronym title="Simple Service Discovery Protocol">SSDP</acronym> Presence Announcement [<cite><a class="bibref" href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>] - a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> NOTIFY request - received from a user-agent-initiated <acronym title="Simple Service Discovery Protocol">SSDP</acronym> Discovery Request [<cite><a class="bibref" href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>], the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> run the following steps:
+         </p>
+
+         <ol class="rule">
+            <li>
+               Let <var>ssdp device</var> be an Object with a property for each <abbr title="Hypertext Transfer Protocol">HTTP</abbr> header received in the received <acronym title="Simple Service Discovery Protocol">SSDP</acronym> Presence Announcement, with each key being the name of a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> header and its
+               value being that <abbr title="Hypertext Transfer Protocol">HTTP</abbr> header's accompanying value.
+            </li>
+
+            <li>
+               If <var>ssdp device</var> does not contain at least one <var>NTS</var>, <var>USN</var> and <var>Location</var> parameter, then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> abort these steps.
+            </li>
+
+            <li>
+               If the first occurrence of <var>NTS</var> has a value other than <code>ssdp:alive</code>, then continue to the step labeled <var>update service monitor</var> below.
+            </li>
+
+            <li>
+               Let <var>root device descriptor file</var> contain the contents of the file located at the <abbr title="Uniform Resource Locator">URL</abbr> provided in the first occurrence of <var>Location</var> obtained according to the rules
+               defined in the section 'Retrieving a description using <abbr title="Hypertext Transfer Protocol">HTTP</abbr>' [<cite><a class="bibref" href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>].
+            </li>
+
+            <li>
+               If <var>root device descriptor file</var> is empty, then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> abort these steps.
+            </li>
+
+            <li>
+               Let <var>advertised services</var> be a <a>list of all advertised services</a> obtained from the <var>root device descriptor file</var> containing all sub-nodes of the <code>serviceList</code> node as described in
+               the section 'Device Description' [<cite><a class="bibref" href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>].
+            </li>
+
+            <li>
+               For each Object <var>advertised service</var> in <var>advertised services</var> run the following steps:
+               <ol class="rule">
+
+                  <li>
+                     Let <var>network service record</var> be an Object consisting of the following empty properties: <code>id</code>, <code>name</code>, <code>type</code>, <code>url</code>, <code>eventsUrl</code>, <code>config</code>.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>id</code> property to the string value of the first occurrence of <var>ssdp device</var>'s <var>USN</var> parameter.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>name</code> property to the string value of the first occurrence of the <var>service</var>'s <code>serviceId</code> property.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>type</code> property to the concatenation of the string <code>upnp:</code> followed by the string value of the first occurrence of the <var>service</var>'s <code>serviceType</code> property.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>url</code> property to the string value of the first occurrence of the <var>service</var>'s <code>controlURL</code> property.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>config</code> property to the string value of the first occurrence of the <var>device</var> property.
+                  </li>
+
+                  <li>
+                     If <var>service</var>'s <code>eventSubURL</code> property is empty, then continue to the step labeled <em>register</em> below.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>eventsUrl</code> property to the string value of the first occurrence of the <var>service</var>'s <code>eventSubURL</code> property.
+                  </li>
+
+                  <li>
+                     <em>Register</em>: For each Object <var>existing service record</var> in the current <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>, run the following sub-steps:
+                     <ol class="rule">
+
+                       <li>
+                        If the <var>existing service record</var>'s <var>id</var> property matches the value of the first occurrence of <var>USN</var> and the
+                        <var>existing service record</var>'s <code>type</code> property matches the value of <var>network service record</var>'s <code>type</code>, then set the
+                        value of <var>existing service record</var> in the current <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>  to the value of the
+                        <var>network service record</var> and skip the next step.
+                       </li>
+                     </ol>
+                  </li>
+
+                  <li>
+                     Add <var>network service record</var> to the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>.
+                  </li>
+
+               </ol>
+            </li>
+            <li>
+               <em>Update Service Monitor</em>: For each non-garbage collected <a href="#networkservice"><code>NetworkService</code></a> object run the following steps:
+
+               <ol class="rule">
+                  <li>
+                     If this <a href="#networkservice"><code>NetworkService</code></a> object's <code>type</code> attribute does not equal the
+                     current <a>network service record</a>'s <code>type</code> property then continue at the next available active
+                     <a href="#networkservice"><code>NetworkService</code></a> object.
+                  </li>
+                  <li>
+                     If the <var>announcement type</var> equals <code>ssdp:alive</code> then increment the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute of the <a href="#networkservices"><code>NetworkServices</code></a>
+                     object by <code>1</code> and then <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a>
+                      to dispatch a newly created event with the name <code>serviceavailable</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
+                      <a href="#networkservice"><code>NetworkServices</code></a> object. Otherwise, decrement the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute of the <a href="#networkservices"><code>NetworkServices</code></a>
+                     object by <code>1</code> and then  <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a>
+                       to dispatch a newly created event with the name <code>serviceunavailable</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
+                       <a href="#networkservice"><code>NetworkServices</code></a> object.
+                  </li>
+                  <li>
+                     If the <var>announcement type</var> equals <code>ssdp:alive</code> then <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a>
+                      to dispatch a newly created event with the name <code>serviceonline</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
+                      <a href="#networkservice"><code>NetworkService</code></a> object. Otherwise, <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a>
+                       to dispatch a newly created event with the name <code>serviceoffline</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
+                       <a href="#networkservice"><code>NetworkService</code></a> object.
+                  </li>
+               </ol>
+            </li>
+         </ol>
+
+         <p>
+            A <dfn id="dfn-user-agent-generated-callback-url">user-agent generated callback url</dfn> is a Local-network accessible <abbr title="Uniform Resource Locator">URL</abbr> endpoint that a <a href="#dfn-user-agent" class="internalDFN">user agent</a> must generate and maintain for receiving <abbr title="Hypertext Transfer Protocol">HTTP</abbr> NOTIFY requests from <abbr title="Universal Plug-and-Play">UPnP</abbr> Event sources.
+         </p>
+
+         <p>When the <a href="#dfn-user-agent" class="internalDFN">user agent</a> is to <dfn id="dfn-setup-a-upnp-events-subscription">setup a <abbr title="Universal Plug-and-Play">UPnP</abbr> Events Subscription</dfn>, it is to run the following steps with the current <var>network service record</var> object:</p>
+
+         <ol class="rule">
+            <li>
+               If <var>network service record</var>'s <code>eventsUrl</code> property is empty then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> abort these steps.
+            </li>
+
+            <li>
+               Let <var>callback <abbr title="Uniform Resource Locator">URL</abbr></var> be the value of creating a new <a href="#dfn-user-agent-generated-callback-url" class="internalDFN">user-agent generated callback url</a>.
+            </li>
+
+            <li>
+               Send a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> SUBSCRIBE request with a <em>NT</em> header with a string value of <code>upnp:event</code>, a <em>TIMEOUT</em> header with an integer value ofƒ
+               <code>86400</code> and a <em>CALLBACK</em> header
+               with a string value of <var>callback <abbr title="Uniform Resource Locator">URL</abbr></var> towards the <var>network service record</var>'s <code>eventsUrl</code> property.
+            </li>
+
+            <li>
+               If a non-200 OK response is received from the <abbr title="Hypertext Transfer Protocol">HTTP</abbr> SUBSCRIBE request then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> abort these steps.
+            </li>
+
+            <li>
+               On receiving a valid 200 OK response, run the following steps:
+
+               <ol class="rule">
+                  <li>
+                     Let <var>callback ID</var> equal the string value of the first included <em>SID</em> header, if it exists.
+                  </li>
+                  <li>
+                     Let <var>timeout date</var> equal the sum of the current UTC date value plus the integer value of the first included <em>TIMEOUT</em> header, if it exists.
+                  </li>
+                  <li>
+                     Run the following steps aynchronously and continue to the step labeled <em>listen</em> below.
+                  </li>
+                  <li>
+                     <em>Refresh Subscription</em>: Run the following steps at a set interval (X) within the <a href="#dfn-user-agent" class="internalDFN">user agent</a>:
+
+                     <ol class="rule">
+                        <li>
+                           Let <var>current date</var> equal the current UTC date.
+                        </li>
+                        <li>
+                           If <var>current date</var> is less than the <var>timeout date</var> then continue to the step labeled <em>refresh subscription</em> above.
+                        </li>
+                        <li>
+                           Send a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> SUBSCRIBE request with a <em>SID</em> header with the string value of <var>callback ID</var> and a <em>TIMEOUT</em> header
+                           with an integer value of <code>86400</code> towards the <var>network service record</var>'s <code>eventsUrl</code> property.
+                        </li>
+                        <li>
+                           On receiving a valid 200 OK, update <var>callback ID</var> with the string value of the first included <em>SID</em> header, if it exists. All other <abbr title="Hypertext Transfer Protocol">HTTP</abbr>
+                           responses should cause the <a href="#dfn-user-agent" class="internalDFN">user agent</a> to continue from the step labeled <em>refresh subscription</em> above.
+                        </li>
+                     </ol>
+
+                  </li>
+
+                  <li>
+                     <em>Listen</em>: For each <abbr title="Hypertext Transfer Protocol">HTTP</abbr> NOTIFY request received at the <var>callback <abbr title="Uniform Resource Locator">URL</abbr></var> the <a href="#dfn-user-agent" class="internalDFN">user agent</a> is to run the following steps:
+
+                     <ol class="rule">
+                        <li>
+                           Let <var>content clone</var> be the result of obtaining the message body of the <abbr title="Hypertext Transfer Protocol">HTTP</abbr> NOTIFY request. If <var>content clone</var> is empty, then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> abort these steps.
+                        </li>
+                        <li>
+                          Let <var>notification event</var> be a new simple event that uses the <code>Event</code> interface with the name <code>notify</code>,
+                           which does not bubble, is not cancellable, and has no default action.
+                        </li>
+                        <li>
+                           Let the <code>data</code> attribute of <var>notification event</var> have the DOMString value of <var>content clone</var>.
+                        </li>
+                        <li>
+                           <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">Queue a task</a> to
+                            dispatch <var>notification event</var> at the current <a href="#networkservice" class="internalDFN"><code>NetworkService</code></a> object.
+                        </li>
+                     </ol>
+                  </li>
+
+               </ol>
+
+            </li>
+         </ol>
+
+         </section>
+
+         <section id="network-topology-monitoring">
+            <h3><span class="secno">7.3 </span>Network Topology Monitoring</h3>
+
+                  <div>
+                     <p>
+                        When the <a href="#dfn-user-agent" class="internalDFN">user agent</a> detects that the user has dropped from their connected network, then it <em class="rfc2119" title="must">must</em> run the following steps:
+                     </p>
+
+                     <ol class="rule">
+                        <li>
+                           Flush all entries from the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>.
+                        </li>
+                        <li>
+                           For each <a href="#networkservice"><code>NetworkService</code></a> object currently active in the <a href="#dfn-user-agent" class="internalDFN">user agent</a> perform the following steps:
+
+                           <ol class="rule">
+                              <li>
+                                 Set the <a href="#dom-networkservice-online"><code>online</code></a> attribute to <code>false</code>.
+                              </li>
+                              <li>
+                                 <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">Queue a task</a>
+                                                      to dispatch a newly created event with the name <code>serviceoffline</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
+                                                      <a href="#networkservice"><code>NetworkService</code></a> object.
+                           </li></ol>
+                        </li>
+                        <li>
+                          For each <a href="#networkservices"><code>NetworkServices</code></a> object currently active in the <a href="#dfn-user-agent" class="internalDFN">user agent</a> perform the following steps:
+
+                          <ol class="rule">
+                            <li>
+                              Let <var>number of available services</var> equal the value of <a href="#networkservices"><code>NetworkServices</code></a>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute.
+                            </li>
+                            <li>
+                              Set the <a href="#networkservices"><code>NetworkServices</code></a>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute to zero (<code>0</code>).
+                            </li>
+                            <li>
+                              For each <var>available service</var> in <var>number of available services</var> the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> fire a new simple event with the name <code>serviceunavailable</code> that has no default action, does not bubble and is not cancellable, at the current <a href="#networkservices"><code>NetworkServices</code></a> object.
+                            </li>
+                          </ol>
+                        </li>
+
+                     </ol>
+
+                     <p>
+                        When the <a href="#dfn-user-agent" class="internalDFN">user agent</a> detects that the user has connected to a new network, then it <em class="rfc2119" title="should">should</em> run the following steps:
+                     </p>
+
+                     <ol class="rule">
+                        <li>
+                           Re-issue an <abbr title="Multicast DNS">mDNS</abbr> search and <acronym title="Simple Service Discovery Protocol">SSDP</acronym> discovery search using all of the <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens initially provided to all active <a href="#networkservices"><code>NetworkServices</code></a> objects and handle all discovery responses according to the processing defined in <a href="#service-discovery">Section 7: Service Discovery</a>.
+                        </li>
+                     </ol>
+                  </div>
+         </section>
+      </section>
+
+   <section id="garbage-collection">
+      <!--OddPage--><h2><span class="secno">8. </span>Garbage collection</h2>
+
+      <p>
+         A <a href="#networkservice" class="internalDFN"><code>NetworkService</code></a> object containing a <code>url</code> parameter currently in the <a href="#dfn-entry-script-origin-s-url-whitelist" class="internalDFN">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a> <em class="rfc2119" title="must not">must not</em> be garbage collected.
+      </p>
+
+      <p>
+         Only when the user navigates away from the current browsing context can <a href="#networkservice" class="internalDFN"><code>NetworkService</code></a> objects be garbage-collected and records in the <a href="#dfn-entry-script-origin-s-url-whitelist" class="internalDFN">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a> be removed.
+      </p>
+
+   </section>
+
+
+    <section id="use-cases-and-requirements">
+      <!--OddPage--><h2><span class="secno">9. </span>Use Cases and Requirements</h2>
+
+      <p>This section covers what the requirements are for this <abbr title="Application Programming Interface">API</abbr>, as well as illustrates some use cases.</p>
+
+      <ul class="rule">
+         <li>
+            Once a user has given permission, user agents should provide the ability for Web pages to communicate directly with a Local-networked Service.
+            <ul class="rule">
+               <li>
+                  Example: A web-based TV remote control. A Web page wants to control the current user's TV, changing the programming shown or increasing/decreasing/muting the
+                  volume of the Local-networked Device. The Web page requests a service type that is known to be implemented by television sets to which it has the
+                  application logic to communicate. Local devices providing the request service types are discovered and presented to the user for authorization. The user selects one
+                  or more of the discovered television sets to be accessible to the current Web page and then clicks 'Share'. The Web page can now communicate directly with
+                  the user-authorized Local-networked services.
+               </li>
+            </ul>
+         </li>
+
+         <li>
+           Web pages should be able to communicate with Local-networked Services using the messaging channel supported by those Devices.
+           <ul class="rule">
+            <li>
+               Example: A Web page advertises that it is capable of controlling multiple Home Media Servers. The user can select their Home Media Server type from a drop-down list, at which point the
+               Web page sends a request to the user agent to connect with the associated service type of the Home Media Server. The Media Server selected implements a Web Socket channel for
+               bi-directional service communication and so the Web page opens a web socket to the requested Media Server and can communicate as required via that appropriate channel.
+            </li>
+           </ul>
+         </li>
+
+         <li>
+           Web pages should be able to communicate with Local-networked Services using the messaging format supported by those Devices.
+           <ul class="rule">
+            <li>
+               Example: A Web page advertises that it is capable of interacting with and controlling multiple types of Home Media Server. The user can select their Home Media Server type from a drop-down list or known Media Servers, at which point the
+               Web page sends a request to the user agent to connect with the associated service type (and, optionally, the associated event type) of the Home Media Server. The communiciation protocols supported by Home Media Servers typically vary
+               between <abbr title="Universal Plug-and-Play">UPnP</abbr>, JSON-RPC, Protocol Buffers or other messaging formats depending on the Home Media Server requested. The Web page is able to communicate with the user-selected Home Media
+               Server in the messaging format supported by that Device, which, in this example is a simple key/value pair text format.
+            </li>
+           </ul>
+         </li>
+
+         <li>
+           Web pages should not be able to communicate with Local-networked Services that have not been authorized by the user thereby maintaining the user's privacy.
+           <ul class="rule">
+            <li>
+               Example: A Web page requests access to one type of Local-networked service. The user authorizes access to that particular service. Other services running on that same device, and on other devices
+               within the network, should not be accessible to the current Web page.
+            </li>
+           </ul>
+         </li>
+
+         <li>
+           A user should be able to share one or more Local-networked Services based on a particular service type request from a Web page.
+           <ul class="rule">
+            <li>
+               Example: A Web page is capable of interacting with a specific profile of Local-networked Service. As such, it makes a request to the user agent to access those services, of which multiple matches
+               are found. The user is capable of selecting one or more of the discovered services to share with the Web page. The Web page can then implement a drag-and-drop interface for the user to drag specific
+               actions on to one or more of the authorized Local-networked Services.
+            </li>
+           </ul>
+         </li>
+
+         <li>
+           User agents should provide an <abbr title="Application Programming Interface">API</abbr> exposed to script that exposes the features above. The user is notified by UI anytime interaction with Local-networked Services is requested, giving the user
+           full ability to cancel or abort the transaction. The user selects the Local-networked Services to be connected to the current Web page, and can cancel these at any time. No invocations to
+           these APIs occur silently without user intervention.
+         </li>
+      </ul>
+    </section>
+
+          <section class="informative appendix" id="examples">
+             <!--OddPage--><h2><span class="secno">A. </span>Examples</h2><p><em>This section is non-normative.</em></p>
+
+           <div class="example">
+            <p>This sample code exposes a button. When clicked, this button is disabled and the user is prompted to offer a network service. The user may also select multiple network services. When the user has authorized a network service to be connected to the web page then the web page issues a simple command to get a list of all the albums stored on the connected media player service.
+            </p><p>The button is re-enabled only when the connected network service disconnects for whatever reason (the service becomes unavailable on the network, the user disconnects from their current network or the user revokes access to the service from the current web page). At this point the user can re-click the button to select a new network service to connect to the web page and the above steps are repeated.</p>
+            <p>The provided service type identifier and service interaction used in this example is based on the well-defined service type and messaging format supported by the <a href="http://xbmc.org/about/">XBMC Media Server</a>. </p>
+            <hr>
+            <pre class="highlight prettyprint"><span class="tag">&lt;input</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"button"</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">"Start"</span><span class="pln"> </span><span class="atn">onclick</span><span class="pun">=</span><span class="atv">"</span><span class="pln">start</span><span class="pun">()</span><span class="atv">"</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"startBtn"</span><span class="tag">/&gt;</span><span class="pln">
+</span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"debugconsole"</span><span class="tag">&gt;&lt;/div&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"> startBtn </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">'startBtn'</span><span class="pun">),</span><span class="pln">
+     debug </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">'debugconsole'</span><span class="pun">);</span><span class="pln">
+
+ </span><span class="kwd">function</span><span class="pln"> start</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+   </span><span class="kwd">if</span><span class="pun">(</span><span class="pln">navigator</span><span class="pun">.</span><span class="pln">getNetworkServices</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">getNetworkServices</span><span class="pun">(</span><span class="str">'zeroconf:_xbmc-jsonrpc._tcp'</span><span class="pun">,</span><span class="pln"> gotXBMCService</span><span class="pun">,</span><span class="pln"> error</span><span class="pun">);</span><span class="pln">
+      startBtn</span><span class="pun">.</span><span class="pln">disabled </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">true</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">
+      debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;Service Discovery not supported!"</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">function</span><span class="pln"> gotXBMCService</span><span class="pun">(</span><span class="pln">services</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+
+</span><span class="com">// Listen for service disconnect messages</span><span class="pln">
+
+   services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'serviceoffline'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln"> e </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+       debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">" disconnected."</span><span class="pun">;</span><span class="pln">
+       startBtn</span><span class="pun">.</span><span class="pln">disabled </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">false</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">// Send a service message to get albums list (and process the service response)</span><span class="pln">
+
+   </span><span class="kwd">var</span><span class="pln"> svcXhr </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">XMLHttpRequest</span><span class="pun">();</span><span class="pln">
+   svcXhr</span><span class="pun">.</span><span class="pln">open</span><span class="pun">(</span><span class="str">"POST"</span><span class="pun">,</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">url </span><span class="pun">+</span><span class="pln"> </span><span class="str">"/getAlbums"</span><span class="pun">);</span><span class="pln"> </span><span class="com">// services[0].url and its subresources have been</span><span class="pln">
+                                                        </span><span class="com">// whitelisted for cross-site XHR use in this</span><span class="pln">
+                                                        </span><span class="com">// current browsing context.</span><span class="pln">
+
+   svcXhr</span><span class="pun">.</span><span class="pln">setRequestHeader</span><span class="pun">(</span><span class="str">'Content-Type'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'application/json-rpc'</span><span class="pun">);</span><span class="pln">
+
+   svcXhr</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'readystatechange'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln"> response </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+     </span><span class="kwd">if</span><span class="pun">(</span><span class="pln"> response</span><span class="pun">.</span><span class="pln">readyState </span><span class="pun">!=</span><span class="pln"> </span><span class="lit">4</span><span class="pln"> </span><span class="pun">||</span><span class="pln"> response</span><span class="pun">.</span><span class="pln">status </span><span class="pun">!=</span><span class="pln"> </span><span class="lit">200</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">
+     debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">" response received: "</span><span class="pun">;</span><span class="pln">
+     debug</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">+=</span><span class="pln"> JSON</span><span class="pun">.</span><span class="pln">parse</span><span class="pun">(</span><span class="pln">response</span><span class="pun">.</span><span class="pln">responseText</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="kwd">var</span><span class="pln"> svcMsg </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="str">"jsonrpc"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2.0"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"method"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"AudioLibrary.GetAlbums"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"params"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"genreid"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">-</span><span class="lit">1</span><span class="pun">,</span><span class="pln">
+         </span><span class="str">"artistid"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">-</span><span class="lit">1</span><span class="pun">,</span><span class="pln"> </span><span class="str">"start"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">-</span><span class="lit">1</span><span class="pun">,</span><span class="pln"> </span><span class="str">"end"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">-</span><span class="lit">1</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">}</span><span class="pln">
+   </span><span class="pun">];</span><span class="pln">
+
+   svcXhr</span><span class="pun">.</span><span class="pln">send</span><span class="pun">(</span><span class="pln">JSON</span><span class="pun">.</span><span class="pln">stringify</span><span class="pun">(</span><span class="pln">svcMsg</span><span class="pun">));</span><span class="pln">
+   debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">" request sent: "</span><span class="pun">;</span><span class="pln">
+   debug</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">+=</span><span class="pln"> JSON</span><span class="pun">.</span><span class="pln">stringify</span><span class="pun">(</span><span class="pln">svcMsg</span><span class="pun">);</span><span class="pln">
+
+ </span><span class="pun">}</span><span class="pln">
+
+ </span><span class="kwd">function</span><span class="pln"> error</span><span class="pun">(</span><span class="pln"> err </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+   debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;An error occurred obtaining a local network service."</span><span class="pun">;</span><span class="pln">
+   startBtn</span><span class="pun">.</span><span class="pln">disabled </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">;</span><span class="pln">
+ </span><span class="pun">}</span><span class="pln">
+</span><span class="tag">&lt;/script&gt;</span></pre>
+           </div>
+
+           <div class="example">
+            <p>
+             This sample exposes a drop-down list containing a number of common Home-based audio devices. When the user selects an audio device from the list provided, they are prompted to authorize a network service
+             based on the service type requested. The user may also select multiple network services matching the selected service type.
+             In this example, the user selects their make as being <var>Sony</var> and their model as being <var>Bravia S1000</var> from which the Web page can derive a service type
+             (<var>urn:schemas-upnp-org:service:RenderingControl:1</var>).
+             <br><br>Once the user has authorized the device, the web page sends a simple mute command according to the messaging format supported by the device.
+            </p>
+            <hr>
+            <pre class="highlight prettyprint"><span class="tag">&lt;select</span><span class="pln"> </span><span class="atn">name</span><span class="pun">=</span><span class="atv">"make"</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"make"</span><span class="tag">&gt;</span><span class="pln">
+  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">selected</span><span class="pun">=</span><span class="atv">"selected"</span><span class="pln"> </span><span class="atn">disabled</span><span class="pun">=</span><span class="atv">"disabled"</span><span class="tag">&gt;</span><span class="pln">Select make</span><span class="tag">&lt;/option&gt;</span><span class="pln">
+  </span><span class="tag">&lt;option&gt;</span><span class="pln">Sony</span><span class="tag">&lt;/option&gt;</span><span class="pln">
+  </span><span class="tag">&lt;option&gt;</span><span class="pln">Philips</span><span class="tag">&lt;/option&gt;</span><span class="pln">
+  </span><span class="tag">&lt;option&gt;</span><span class="pln">Alba</span><span class="tag">&lt;/option&gt;</span><span class="pln">
+</span><span class="tag">&lt;/select&gt;</span><span class="pln">
+</span><span class="tag">&lt;select</span><span class="pln"> </span><span class="atn">name</span><span class="pun">=</span><span class="atv">"model"</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"model"</span><span class="tag">&gt;&lt;/select&gt;</span><span class="pln">
+</span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"debugconsole"</span><span class="tag">&gt;&lt;/div&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"> debug </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">'debugconsole'</span><span class="pun">);</span><span class="pln">
+
+  </span><span class="kwd">var</span><span class="pln"> models </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+    </span><span class="str">"Sony"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="pln">
+      </span><span class="pun">{</span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"Bravia TV S1000"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"type"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"upnp"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"service"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"urn:schemas-upnp-org:service:RenderingControl:1"</span><span class="pln"> </span><span class="pun">},</span><span class="pln">
+      </span><span class="pun">{</span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"Bravia TV S2000"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"type"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"zeroconf"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"service"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"_mediarenderer._http._tcp"</span><span class="pln"> </span><span class="pun">},</span><span class="pln">
+      </span><span class="pun">{</span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"HiFi WD10"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"type"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"upnp"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"service"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"urn:schemas-upnp-org:service:RenderingControl:1"</span><span class="pln"> </span><span class="pun">}</span><span class="pln">
+    </span><span class="pun">],</span><span class="pln">
+    </span><span class="str">"Philips"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="pln"> </span><span class="com">/* ... */</span><span class="pln"> </span><span class="pun">],</span><span class="pln">
+    </span><span class="str">"Alba"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="pln"> </span><span class="com">/* ... */</span><span class="pln"> </span><span class="pun">]</span><span class="pln">
+  </span><span class="pun">};</span><span class="pln">
+
+  </span><span class="kwd">var</span><span class="pln"> makeEl </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">"make"</span><span class="pun">),</span><span class="pln">
+      modelEl </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">"model"</span><span class="pun">);</span><span class="pln">
+
+  makeEl</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">
+    modelEl</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">=</span><span class="pln"> </span><span class="str">""</span><span class="pun">;</span><span class="pln"> </span><span class="com">// reset</span><span class="pln">
+    </span><span class="kwd">var</span><span class="pln"> defaultOption </span><span class="pun">=</span><span class="pln"> document</span><span class="pun">.</span><span class="pln">createElement</span><span class="pun">(</span><span class="str">"option"</span><span class="pun">);</span><span class="pln">
+    defaultOption</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">=</span><span class="pln"> </span><span class="str">"Select model"</span><span class="pun">;</span><span class="pln">
+    defaultOption</span><span class="pun">.</span><span class="pln">setAttribute</span><span class="pun">(</span><span class="str">"disabled"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"disabled"</span><span class="pun">);</span><span class="pln">
+    defaultOption</span><span class="pun">.</span><span class="pln">setAttribute</span><span class="pun">(</span><span class="str">"selected"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"selected"</span><span class="pun">);</span><span class="pln">
+    modelEl</span><span class="pun">.</span><span class="pln">appendChild</span><span class="pun">(</span><span class="pln">defaultOption</span><span class="pun">);</span><span class="pln">
+    </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class="pln"> i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> l </span><span class="pun">=</span><span class="pln"> models</span><span class="pun">[</span><span class="pln">makeEl</span><span class="pun">.</span><span class="pln">value</span><span class="pun">].</span><span class="pln">length</span><span class="pun">;</span><span class="pln"> i </span><span class="pun">&lt;</span><span class="pln"> l</span><span class="pun">;</span><span class="pln"> i</span><span class="pun">++)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+      </span><span class="kwd">var</span><span class="pln"> option </span><span class="pun">=</span><span class="pln"> document</span><span class="pun">.</span><span class="pln">createElement</span><span class="pun">(</span><span class="str">"option"</span><span class="pun">);</span><span class="pln">
+      option</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">=</span><span class="pln"> models</span><span class="pun">[</span><span class="pln">makeEl</span><span class="pun">.</span><span class="pln">value</span><span class="pun">][</span><span class="pln">i</span><span class="pun">][</span><span class="str">"name"</span><span class="pun">];</span><span class="pln">
+      option</span><span class="pun">.</span><span class="pln">setAttribute</span><span class="pun">(</span><span class="str">"value"</span><span class="pun">,</span><span class="pln"> models</span><span class="pun">[</span><span class="pln">makeEl</span><span class="pun">.</span><span class="pln">value</span><span class="pun">][</span><span class="pln">i</span><span class="pun">][</span><span class="str">"type"</span><span class="pun">]</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class="str">":"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> models</span><span class="pun">[</span><span class="pln">makeEl</span><span class="pun">.</span><span class="pln">value</span><span class="pun">][</span><span class="pln">i</span><span class="pun">][</span><span class="str">"service"</span><span class="pun">]);</span><span class="pln">
+      modelEl</span><span class="pun">.</span><span class="pln">appendChild</span><span class="pun">(</span><span class="pln">option</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">
+
+  modelEl</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="pun">(</span><span class="pln">navigator</span><span class="pun">.</span><span class="pln">getNetworkServices </span><span class="pun">&amp;&amp;</span><span class="pln">
+         modelEl</span><span class="pun">.</span><span class="pln">value </span><span class="pun">==</span><span class="pln"> </span><span class="str">"upnp:urn:schemas-upnp-org:service:RenderingControl:1"</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">getNetworkServices</span><span class="pun">(</span><span class="pln">modelEl</span><span class="pun">.</span><span class="pln">value</span><span class="pun">,</span><span class="pln"> successCallback</span><span class="pun">,</span><span class="pln"> errorCallback</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="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">modelEl</span><span class="pun">.</span><span class="pln">value </span><span class="pun">==</span><span class="pln"> </span><span class="str">"zeroconf:_mediarenderer._http._tcp"</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+      debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;Service type is not implemented by this application."</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">
+      debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;Service Discovery is not supported!"</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="tag">&lt;/script&gt;</span><span class="pln">
+
+</span><span class="tag">&lt;script&gt;</span><span class="pln">
+  </span><span class="kwd">function</span><span class="pln"> successCallback</span><span class="pun">(</span><span class="pln"> services </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+
+  </span><span class="com">// Listen for service push notification messages</span><span class="pln">
+
+    services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'notify'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln"> msg </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+         debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">" event received: "</span><span class="pun">;</span><span class="pln">
+         debug</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">+=</span><span class="pln"> msg</span><span class="pun">.</span><span class="pln">data</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">// Send a control signal to mute the service audio</span><span class="pln">
+
+    </span><span class="kwd">var</span><span class="pln"> svcXhr </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">XMLHttpRequest</span><span class="pun">();</span><span class="pln">
+    svcXhr</span><span class="pun">.</span><span class="pln">open</span><span class="pun">(</span><span class="str">"POST"</span><span class="pun">,</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">url</span><span class="pun">);</span><span class="pln"> </span><span class="com">// services[0].url and its</span><span class="pln">
+                                          </span><span class="com">// subresources have been whitelisted for</span><span class="pln">
+                                          </span><span class="com">// cross-site XHR use in this current</span><span class="pln">
+                                          </span><span class="com">// browsing context.</span><span class="pln">
+
+    svcXhr</span><span class="pun">.</span><span class="pln">setRequestHeader</span><span class="pun">(</span><span class="str">'SOAPAction'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'urn:schemas-upnp-org:service:RenderingControl:1#SetMute'</span><span class="pun">);</span><span class="pln">
+    svcXhr</span><span class="pun">.</span><span class="pln">setRequestHeader</span><span class="pun">(</span><span class="str">'Content-Type'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'text/xml; charset="utf-8";'</span><span class="pun">);</span><span class="pln">
+
+    svcXhr</span><span class="pun">.</span><span class="pln">onreadystatechange </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln"> response </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+      </span><span class="kwd">if</span><span class="pun">(</span><span class="pln"> response</span><span class="pun">.</span><span class="pln">readyState </span><span class="pun">!=</span><span class="pln"> </span><span class="lit">4</span><span class="pln"> </span><span class="pun">||</span><span class="pln"> response</span><span class="pun">.</span><span class="pln">status </span><span class="pun">!=</span><span class="pln"> </span><span class="lit">200</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">
+      debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">" response received: "</span><span class="pun">;</span><span class="pln">
+      debug</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">+=</span><span class="pln"> response</span><span class="pun">.</span><span class="pln">responseXML</span><span class="pun">;</span><span class="pln">
+    </span><span class="pun">}</span><span class="pln">
+
+    </span><span class="com">// Service messaging to mute the provided service</span><span class="pln">
+    </span><span class="kwd">var</span><span class="pln"> svcMsg </span><span class="pun">=</span><span class="pln"> </span><span class="str">'&lt;?xml version="1.0" encoding="utf-8"?&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                 </span><span class="str">'&lt;s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" '</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                   </span><span class="str">'xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                   </span><span class="str">'&lt;s:Body&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                     </span><span class="str">'&lt;u:SetMute xmlns:u="urn:schemas-upnp-org:service:RenderingControl:1"&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                       </span><span class="str">'&lt;InstanceID&gt;0&lt;/InstanceID&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                       </span><span class="str">'&lt;Channel&gt;Master&lt;/Channel&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                       </span><span class="str">'&lt;DesiredMute&gt;true&lt;/DesiredMute&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                     </span><span class="str">'&lt;/u:SetMute&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                   </span><span class="str">'&lt;/s:Body&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                 </span><span class="str">'&lt;/s:Envelope&gt;'</span><span class="pun">;</span><span class="pln">
+
+    svcXhr</span><span class="pun">.</span><span class="pln">send</span><span class="pun">(</span><span class="pln">svcMsg</span><span class="pun">);</span><span class="pln">
+    debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">" request sent: "</span><span class="pun">;</span><span class="pln">
+    debug</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">+=</span><span class="pln"> svcMsg</span><span class="pun">;</span><span class="pln">
+  </span><span class="pun">}</span><span class="pln">
+
+  </span><span class="kwd">function</span><span class="pln"> errorCallback</span><span class="pun">(</span><span class="pln"> error </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+    debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;An error occurred: "</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> error</span><span class="pun">.</span><span class="pln">code</span><span class="pun">;</span><span class="pln">
+  </span><span class="pun">}</span><span class="pln">
+</span><span class="tag">&lt;/script&gt;</span></pre>
+          </div>
+
+       </section>
+
+    <section id="acknowledgements">
+      <!--OddPage--><h2><span class="secno">B. </span>Acknowledgements</h2>
+
+      <p>Thanks are expressed by the editor to the following individuals for their feedback on this specification to date (in alphabetical order):
+      <br><br>
+      Gar Bergstedt, Lars-Erik Bolstad, Cathy Chan, Hari G Kumar, Bob Lund, Giuseppe Pascale, Marcin Simonides, Clarke Stevens, Christian Söderström, Mark Vickers, ...</p>
+
+      <p>Thanks are also expressed by the editor to the following organizations and groups for their support in producing this specification to date (in alphabetical order):
+      <br><br>
+      CableLabs, Opera Software ASA, <abbr title="World Wide Web Consortium">W3C</abbr> Device APIs Working Group, <abbr title="World Wide Web Consortium">W3C</abbr> Web and TV Interest Group, ...</p>
+    </section>
+
+
+<section id="references" class="appendix"><!--OddPage--><h2><span class="secno">C. </span>References</h2><section id="normative-references"><h3><span class="secno">C.1 </span>Normative references</h3><dl class="bibliography"><dt id="bib-DNS-SD">[DNS-SD]</dt><dd>S. Cheshire; M. Krochmal. <a href="http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt"><cite>DNS-Based Service Discovery.</cite></a> 27 February 2011. IETF Draft. URL: <a href="http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt">http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt</a>
+</dd><dt id="bib-DOM4">[DOM4]</dt><dd>Anne van Kesteren; Aryeh Gregor; Ms2ger. <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html/"><cite>DOM4.</cite></a> URL: <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html/">http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html/</a>
+</dd><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-MDNS">[MDNS]</dt><dd>S. Cheshire; M. Krochmal. <a href="http://files.multicastdns.org/draft-cheshire-dnsext-multicastdns.txt"><cite>Multicast DNS.</cite></a> 14 February 2011. IETF Draft. URL: <a href="http://files.multicastdns.org/draft-cheshire-dnsext-multicastdns.txt">http://files.multicastdns.org/draft-cheshire-dnsext-multicastdns.txt</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-UPNP-DEVICEARCH11">[UPNP-DEVICEARCH11]</dt><dd><a href="http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf"><cite>UPnP Device Architecture 1.1</cite></a>. 15 October 2008. UPnP Forum. PDF document. URL: <a href="http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf">http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf</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 id="informative-references"><h3><span class="secno">C.2 </span>Informative references</h3><p>No informative references.</p></section></section></body></html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/discovery-api/Overview.src.html	Mon Sep 03 15:35:05 2012 +0200
@@ -0,0 +1,1556 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Networked Service Discovery and Messaging</title>
+    <meta http-equiv='Content-Type' content='text/html;charset=utf-8'/>
+    <script type="text/javascript" class='remove'>
+      var respecConfig = {
+          specStatus:   "ED",
+          //publishDate:  "2012-08-22",
+          shortName:    "discovery-api",
+          edDraftURI:   "http://w3c-test.org/dap/discovery-api/",
+          previousMaturity: "WD",
+          previousPublishDate: "2012-08-07",
+          editors: [
+            {
+              name:       "Rich Tibbett",
+              //url:        "http://richt.me/",
+              company:    "Opera Software ASA",
+              companyURL: "http://opera.com/"
+            },
+            {
+              name:       "Clarke Stevens",
+              //url:      "",
+              company:    "CableLabs",
+              companyURL: "http://cablelabs.com/"
+            }
+          ],
+          noIDLIn:      true,
+          wg:           "Device APIs and Policy Working Group",
+          wgURI:        "http://www.w3.org/2009/dap/",
+          wgPublicList: "public-device-apis",
+          wgPatentURI:  "http://www.w3.org/2004/01/pp-impl/43696/status"
+      };
+    </script>
+
+    <script src='http://www.w3.org/Tools/respec/respec-w3c-common' type="text/javascript" class='remove' async></script>
+    <style type="text/css">
+      /* Custom CSS optimizations (Richard Tibbett) */
+
+      /* Add better spacing to sections */
+      section, .section { margin-bottom: 2em; }
+
+      /* Reduce note & issue render size */
+      .note, .issue { font-size:0.8em; }
+
+      /* Add addition spacing to <ol> and <ul> for rule definition */
+      ol.rule li, ul.rule li { padding:0.6em; }
+
+      pre.widl { border: solid thin; background: #EEEEEE; color: black; padding: 0.5em 1em; position: relative; }
+      pre.widl :link, pre.widl :visited { color: #000; background: transparent; }
+      pre.widl:before { content: "IDL"; font: bold small sans-serif; padding: 0.5em; background: white; position: absolute; top: 0; margin: -1px 0 0 -4em; width: 1.5em; border: thin solid; border-radius: 0 0 0 0.5em }
+
+      div.example { border: solid thin red; background: #F7DFE5; color: black; padding: 0.5em 1em; position: relative; margin: 1em 0 1em 4.6em; width: auto; }
+      div.example:before { content: "EXAMPLE"; font: bold small sans-serif; padding: 0.5em; background: red; color: white; position: absolute; top: 0; margin: -1px 0 0 -7.6em; width: 5em; border: thin solid red; border-radius: 0 0 0 0.5em }
+
+      dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
+      hr + dl.domintro, div.impl + dl.domintro { margin-top: 2.5em; margin-bottom: 1.5em; }
+      dl.domintro dt, dl.domintro dt * { color: black; text-decoration: none; }
+      dl.domintro dd { margin: 0.5em 0 1em 2em; padding: 0; }
+      dl.domintro dd p { margin: 0.5em 0; }
+      dl.domintro code {font-size: inherit; font-style: italic; }
+      dl.domintro:before { display: table; margin: -1em -0.5em 0.5em auto; width: auto; content: 'This box is non-normative. Implementation requirements are given below this box.'; color: red; border: solid 2px; background: white; padding: 0 0.25em; }
+    </style>
+  </head>
+
+  <body>
+    <section id='abstract'>
+      <p>
+        This specification defines a mechanism for an HTML document to discover and subsequently communicate with <abbr title="Hypertext Transfer Protocol">HTTP</abbr>-based services
+        advertised via common discovery protocols within a user's network.
+      </p>
+    </section>
+
+    <section id='sotd'>
+      <p>
+        This document represents the early consensus of the group on the scope and features of the proposed
+        API.
+      </p>
+    </section>
+
+    <section class="informative">
+      <h3>Introduction</h3>
+
+      <p>To enable Web pages to connect and communicate with Local-networked Services provided over HTTP, this specification introduces the
+      <a href="#navigatornetworkservice"><code>NavigatorNetworkService</code></a> interface.</p>
+
+      <p>
+         Using this <abbr title="Application Programming Interface">API</abbr> consists of requesting a well-known service type, known by developers and advertised by Local-networked Devices. User authorization, where the user connects the web page to one or more discovered services,
+         is expected before the web page is able to interact with any Local-networked Services.
+      </p>
+
+      <p>
+         A web page creates a request to obtain connectivity to services running in the network by specifying a well-known discovery service type that it wishes to interact with.
+      </p>
+
+      <p>
+         The user agent, having captured all advertised services on the network from the Service Discovery mechanisms included in this recommendation, attempts to match
+      the requested service type to a discovered service according to the processing described herein.
+      </p>
+
+      <p>
+          If a service connectivity request is successful then the Web page is provided with the necessary information to communicate with the authorized Local-networked Service.
+          If the request fails then the Web page will receive an error callback containing an error code describing the cause of Local-networked Service connectivity failure.
+      </p>
+
+      <p>
+         Once connected to a Local-networked Service the Web page can send requests and receive responses to the Local-networked Service via the messaging format and appropriate channel inferred from the service type
+         authorized via the provided API.
+         The Web page, once connected, can also receive service-pushed events, in the messaging format supported by the Local-networked Device, if such event subscription functionality is provided by the
+         connected Local-networked Service.
+      </p>
+
+      <div class="example">
+       <p>Example of requesting a DNS-SD advertised service:</p>
+       <hr />
+       <pre class="highlight">function showServices( services ) {
+  // Show a list of all the services provided to the web page
+  for(var i = 0, l = services.length; i < l; i++) console.log( services[i].name );
+}
+
+navigator.getNetworkServices('zeroconf:_boxee-jsonrpc._tcp', showServices);</pre>
+      </div>
+
+      <div class="example">
+        <p>Example of requesting a UPnP advertised service, also handling error conditions:</p>
+        <hr />
+        <pre class="highlight">function showServices( services ) {
+  // Show a list of all the services provided to the web page
+  for(var i = 0, l = services.length; i < l; i++) console.log( services[i].name );
+}
+
+function error( e ) {
+  console.log( "Error occurred: " + e.code );
+}
+
+navigator.getNetworkServices('upnp:urn:schemas-upnp-org:service:ContentDirectory:1', showServices, error);</pre>
+      </div>
+
+      <div class="example">
+        <p>Example of requesting either a DNS-SD or UPnP advertised service:</p>
+        <hr />
+        <pre class="highlight">function showServices( services ) {
+  // Show a list of all the services provided to the web page (+ service type)
+  for(var i = 0, l = services.length; i < l; i++)
+     console.log( services[i].name + '(' + services[i].type + ')' );
+}
+
+navigator.getNetworkServices([
+  'zeroconf:_boxee-jsonrpc._tcp',
+  'upnp:urn:schemas-upnp-org:service:ContentDirectory:1'
+], showServices);</pre>
+      </div>
+
+      <p>For more detailed examples see the <a href="#examples">Examples</a> section.
+    </section>
+
+    <section
+     id='conformance'>
+
+     <p>Requirements phrased in the imperative as part of algorithms (such as "strip any leading space characters" or "return false and abort these steps") are to be interpreted with the
+     meaning of the key word ("must", "should", "may", etc) used in introducing the algorithm.</p>
+
+     <p>
+      Some conformance requirements are phrased as requirements on attributes, methods or objects. Such requirements are to be interpreted as requirements on user agents.
+     </p>
+
+     <p>
+      Conformance requirements phrased as algorithms or specific steps may be implemented in any manner, so long as the end result is equivalent. (In particular, the algorithms defined in
+      this specification are intended to be easy to follow, and not intended to be performant.)
+     </p>
+
+     <p>
+      The only conformance class defined by this specification is a <dfn>user agent</dfn>.
+     </p>
+
+     <p>
+      User agents may impose implementation-specific limits on otherwise unconstrained inputs, e.g. to prevent denial of service attacks, to guard against running out of memory, or to work
+      around platform-specific limitations.
+     </p>
+
+     <p>
+      When support for a feature is disabled (e.g. as an emergency measure to mitigate a security problem, or to aid in development, or for performance reasons), user agents must act as if
+      they had no support for the feature whatsoever, and as if the feature was not mentioned in this specification. For example, if a particular feature is accessed via an attribute in a Web
+      IDL interface, the attribute itself would be omitted from the objects that implement that interface - leaving the attribute on the object but making it return null or throw an exception
+      is insufficient.
+     </p>
+
+      <section>
+         <h3>Dependencies</h3>
+
+         This specification relies on several other underlying specifications.
+
+         <dl>
+            <dt>HTML</dt>
+            <dd>Many fundamental concepts from HTML are used by this specification. [[!HTML5]]</dd>
+            <dt>WebIDL</dt>
+            <dd>The IDL blocks in this specification use the semantics of the WebIDL specification. [[!WEBIDL]]</dd>
+         </dl>
+      </section>
+    </section>
+
+    <section>
+      <h3>Terminology</h3>
+
+      <p>
+         The construction "a <code>Foo</code> object", where <code>Foo</code> is actually an interface, is sometimes used instead of the more accurate "an object implementing the interface <code>Foo</code>".
+      </p>
+
+      <p>
+         The term DOM is used to refer to the API set made available to scripts in Web applications, and does not necessarily imply the existence of an actual <code>Document</code> object or of any
+         other <code>Node</code> objects as defined in the DOM Core specifications. [[!DOM4]]
+      </p>
+
+      <p>
+         An IDL attribute is said to be <em>getting</em> when its value is being retrieved (e.g. by author script), and is said to be <em>setting</em> when a new value is assigned to it.
+      </p>
+
+      <p>
+        A <dfn>valid service type</dfn> is a string that begins with <code>upnp:</code> or <code>zeroconf:</code> followed by one or more characters in the ranges U+0021, U+0023 to U+0027, U+002A to U+002B, U+002D to U+002E, U+0030 to U+0039, U+0041 to U+005A, U+005E to U+007E.
+      </p>
+
+      <p>
+        A <a>valid service type</a> provided in the <code>type</code> attribute of the <code>getNetworkServices()</code> method will be matched against the services currently contained in the <a>list of available service records</a> according to the algorithms defined in this specification.
+      </p>
+    </section>
+
+    <section>
+     <h2>Requesting networked services</h2>
+
+
+<pre class="widl">[Supplemental, NoInterfaceObject]
+interface <dfn id="navigatornetworkservice">NavigatorNetworkService</dfn> {
+  // Obtain a Local-networked Service
+  void <a href="#dom-navigator-getnetworkservices">getNetworkServices</a>( in any type,
+                           in <a href="#navigatornetworkservicesuccesscallback">NavigatorNetworkServiceSuccessCallback</a> successCallback,
+                           in optional <a href="#navigatornetworkserviceerrorcallback">NavigatorNetworkServiceErrorCallback</a> errorCallback );
+};
+<a class="externalDFN" href="http://www.whatwg.org/specs/web-apps/current-work/complete/timers.html#navigator">Navigator</a> implements <a href="#navigatornetworkservice">NavigatorNetworkService</a>;
+
+[Callback=FunctionOnly, NoInterfaceObject]
+interface <dfn id="navigatornetworkservicesuccesscallback">NavigatorNetworkServiceSuccessCallback</dfn> {
+  void handleEvent( in <a href="#networkservices">NetworkServices</a> services );
+};
+
+[NoInterfaceObject]
+interface <dfn id="navigatornetworkserviceerror">NavigatorNetworkServiceError</dfn> {
+  const unsigned short <a href="#dom-navigatornetworkserviceerror-permission_denied">PERMISSION_DENIED_ERR</a> = 1;
+  const unsigned short <a href="#dom-navigatornetworkserviceerror-unknown_type_prefix">UNKNOWN_TYPE_PREFIX_ERR</a> = 2;
+  readonly attribute unsigned short <a href="#dom-navigatornetworkserviceerror-code">code</a>;
+};
+
+[Callback=FunctionOnly, NoInterfaceObject]
+interface <dfn id="navigatornetworkserviceerrorcallback">NavigatorNetworkServiceErrorCallback</dfn> {
+  void handleEvent( in <a href="#navigatornetworkserviceerror">NavigatorNetworkServiceError</a> error );
+};
+</pre>
+
+  <section>
+   <h2>Methods</h2>
+
+      <dl class="domintro">
+        <dt>
+          <var title="">window</var>
+           .
+          <code title="dom-navigator">
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/timers.html#navigator">navigator</a>
+          </code>
+           .
+          <code title="dom-navigator-getNetworkServices">
+            <a href="#dom-navigator-getnetworkservices">getNetworkServices</a>
+          </code>
+          (
+          <var title="">type</var>
+          ,
+          <var title="">successCallback</var>
+           [,
+          <var title="">errorCallback</var>
+           ] )
+        </dt>
+        <dd>
+          <p>Prompts the user to select one or more discovered network services that have advertised support for the requested service type.</p>
+          <p>
+            The
+            <var title="">type</var>
+             argument contains one or more <a>valid service type</a> tokens that the web page would like to interact with.
+          </p>
+          <p>
+            If the user accepts, the
+            <var title="">successCallback</var>
+             is
+          invoked, with one or more
+            <code>
+              <a href="#networkservice"><code>NetworkService</code></a>
+            </code>
+             objects as
+          its argument.
+          </p>
+          <p>
+            If the user declines, the
+            <var title="">errorCallback</var>
+             (if
+          any) is invoked.
+          </p>
+        </dd>
+      </dl>
+
+       <div>
+          <p>
+            When the <dfn id="dom-navigator-getnetworkservices" title="dom-navigator-getnetworkservices"><code>getNetworkServices(type, successCallback[, errorCallback])</code></dfn> method is called, the <a>user agent</a> MUST run the following steps:
+          </p>
+
+          <ol class="rule">
+
+            <li>
+              Let <var>requested control types</var> be initially set to an empty array.
+            </li>
+
+            <li>
+               If <var>type</var> is an array consisting of one or more <a>valid service type</a> tokens, then let <var>requested control types</var> by the value of <var>type</var>, removing any non-<a>valid service type</a> tokens from the resulting array.
+            </li>
+
+            <li>
+               If <var>type</var> is a string consisting of one <a>valid service type</a> token, then let <var>requested control types</var> be an array containing one item with a value of <var>type</var>.
+            </li>
+
+            <li>
+               If <var>requested control types</var> is an array that contains at least one or more <a title="valid service type">valid service type</a> tokens then continue to the step labeled <em>process</em> below. Otherwise, the <a>user agent</a> MUST <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose
+                 <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 2
+                  (<a href="#dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></a>) as its argument,
+                   abort any remaining steps and return.
+            </li>
+
+            <li>
+               <em>Process</em>: Let <var>services found</var> be an empty array.
+            </li>
+
+            <li>
+               For each <var>available service</var> in the <a>list of available service records</a> run the following steps:
+               <ol class="rule">
+                  <li>
+                    For each <var>requested control type</var> in <var>requested control types</var>: If <var>available service</var>'s <code>type</code> attribute equals the <var>requested control type</var> then let <var>matched service</var> equal the value of <var>available service</var> and continue at the step labeled <var>attach</var> below.
+                  </li>
+                  <li>
+                     Continue at the next <var>available service</var>.
+                  </li>
+                  <li>
+                     <em>Attach</em>: If <var>matched service</var> is not empty then run the following steps:
+
+                     <ol class="rule">
+                        <li>
+                           Let <var>new service object</var> be a new <a href="#networkservice"><code>NetworkService</code></a> object, mapping the parameters of
+                     <var>matched service</var> to this new object where possible.
+                        </li>
+                        <li>
+                           Append <var>new service object</var> to the <var>services found</var> array.
+                        </li>
+                     </ol>
+                  </li>
+               </ol>
+            </li>
+
+            <li>
+               If <var>services found</var> is an empty array, then the <a>user agent</a> MUST <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose
+                 <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1
+                 (<a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its argument, abort any remaining steps and return.
+            </li>
+
+            <li>
+               Return, and run the remaining steps asynchronously.
+            </li>
+
+            <li>
+               Optionally, e.g. based on a previously-established user preference, for security reasons, or due to platform limitations, the <a>user agent</a> MAY <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose
+                 <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1
+                 (<a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its argument, abort any remaining steps and return.
+            </li>
+
+            <li>
+                  The <a>user agent</a> MUST prompt the user in a user-agent-specific manner for permission to provide the
+                  <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" class="externalDFN">entry script</a>'s
+                  <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" class="externalDFN">origin</a> with an array of
+                  <a href="#networkservice"><code>NetworkService</code></a> objects representing the user-authorized subset of <var>services found</var>.
+
+               <p>
+                  If the user grants permission to access one or more networked services then the <a>user agent</a> SHOULD include an
+                  "ongoing local-network communication" indicator.
+               </p>
+
+               <p>If the user denies permission, then the <a>user agent</a> MUST <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose
+                <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1
+                (<a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its argument, abort any remaining steps and return.
+              </p>
+
+              <p>
+                If the user never responds, this algorithm stalls on this step.
+              </p>
+
+            </li>
+
+            <li>
+               Let <var>services</var> be the array of one or more <a href="#networkservice"><code>NetworkService</code></a> objects for which the user granted permission.
+            </li>
+
+            <li>
+               For each Object <var>service</var> in <var>services</var>, run the following substeps:
+
+               <ol class="rule">
+                  <li>
+                     Add the <var>service</var>'s <code>url</code> parameter to the <a>entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a>.
+                  </li>
+                  <li>
+                    If <var>service</var>'s <code>type</code> parameter begins with the DOMString &quot;<code>upnp:</code>&quot; and the <var>service</var>'s <code>eventsUrl</code> parameter is not empty then <a>setup a UPnP Events Subscription</a> for <var>service</var>.
+                  </li>
+               </ol>
+            </li>
+
+            <li>
+               Let <var>services manager</var> be a new <a href="#networkservices"><code>NetworkServices</code></a> object.
+            </li>
+
+            <li>
+               Set <var>services manager</var>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute to the length of <var>services</var>.
+            </li>
+
+            <li>
+              Store the set of <var>services</var> as <dfn id="current_authorized_services">current authorized services</dfn> internally against the newly created <var>services manager</var> object.
+            </li>
+
+            <li>
+               The <a>user agent</a> MUST <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>successCallback</var> with
+               <var>services manager</var> as its argument.
+            </li>
+
+          </ol>
+
+          <p>
+            The <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#task-source" class="externalDFN">task source</a> for these
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#concept-task" class="externalDFN">tasks</a> is the
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#user-interaction-task-source" class="externalDFN">user interaction task source</a>.
+          </p>
+
+          <p>
+            When a <a href="#networkservice"><code>NetworkService</code></a> object is provided to a Web page, the <a>user agent</a> MUST add the <code>url</code> property
+             to the <dfn>entry script origin's URL whitelist</dfn>. This list enables the
+            Web page to override and initiate cross-site resource requests towards these URLs, and any sub-resources of these URLs, within the current
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" class="externalDFN">entry script</a>'s
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" class="externalDFN">origin</a> via various existing mechanisms (e.g. Web Sockets, Server-Sent Events,
+            Web Messaging, XMLHttpRequest).
+         </p>
+
+         <p>
+            If the user navigates away from the current browsing context, the <a>user agent</a> MUST remove all previously whitelisted urls from the <a>entry script origin's URL whitelist</a>.
+            There is no persistence to network service selections provided to a web page. It is not possible to access a previously white-listed networked service without the necessary user authorization in all of the following cases:
+            <ul>
+              <li>If the current script is reloaded at any point in the same or different window.</li>
+              <li>if the current script reinvokes the <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> method at any point in its execution.</li>
+              <li>If the user navigates forward or back in their history to reload the current page.</li>
+              <li>If a script is running in a different origin.</li>
+            </ul>
+         </p>
+
+      </div>
+      </section>
+
+      <section>
+         <h3>Error Handling</h3>
+
+      <dl class="domintro">
+        <dt>
+          <var title="">error</var>
+           .
+          <code title="dom-NavigatorNetworkServiceError-code">
+            <a href="#dom-navigatornetworkserviceerror-code">code</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            Returns the current error's error code. At the current time, this may be <code>1</code> or <code>2</code>, for which the
+            corresponding error constants
+            <a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a> and
+            <a href="#dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></a> are defined.
+          </p>
+        </dd>
+      </dl>
+
+         <p>
+            The <dfn id="dom-navigatornetworkserviceerror-code" title="dom-navigatornetworkserviceerror-code"><code>code</code></dfn> attribute of a
+            <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object MUST return the code for the error, which will be one of the following:
+         </p>
+
+         <dl>
+            <dt>
+               <dfn id="dom-navigatornetworkserviceerror-permission_denied" title="dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></dfn> (numeric value 1)
+            </dt>
+            <dd>
+               The user or user agent denied the page permission to access any services.
+            </dd>
+            <dt>
+               <dfn id="dom-navigatornetworkserviceerror-unknown_type_prefix" title="dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></dfn> (numeric value 2)
+            </dt>
+            <dd>
+               No <a>valid service type</a> tokens were provided in the method invocation.
+            </dd>
+         </dl>
+
+      </section>
+
+      </section>
+      <section>
+      <h2>Obtaining networked services</h2>
+
+      <p>
+         The <a href="#networkservices"><code>NetworkServices</code></a> interface is the top-level response object from a call to <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> and provides access to a set of user-authorized <a href="#networkservice"><code>NetworkService</code></a> objects for the given request.
+      </p>
+
+<pre class="widl">
+[NoInterfaceObject]
+interface <dfn id="networkservices">NetworkServices</dfn> {
+  readonly attribute unsigned long    <a href="#dom-networkservices-length">length</a>;
+  getter <a href="#networkservice">NetworkService</a> (unsigned long index);
+  <a href="#networkservice">NetworkService</a>? <a href="#dom-networkservices-getservicebyid">getServiceById</a>(DOMString id);
+
+  readonly attribute unsigned long    <a href="#dom-networkservices-servicesavailable">servicesAvailable</a>;
+
+  // event handler attributes
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservices-onserviceavailable">onserviceavailable</a>;
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservices-onserviceunavailable">onserviceunavailable</a>;
+
+};
+
+<a href="#networkservices">NetworkServices</a> implements <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-eventtarget" class="externalDFN">EventTarget</a>;
+</pre>
+
+      <section>
+      <h2>Attributes</h2>
+
+        <dl class="domintro">
+          <dt>
+            <code title="dom-networkservices-length">
+              <a href="#dom-networkservices-length">length</a>
+            </code>
+          </dt>
+          <dd>
+            <p>
+              Returns the current number of services in the respective object's <a>current authorized services</a>.
+            </p>
+          </dd>
+          <dt>
+            <code title="dom-networkservices-servicesavailable">
+              <a href="#dom-networkservices-servicesavailable">servicesAvailable</a>
+            </code>
+          </dt>
+          <dd>
+            <p>
+              Returns the current number of services matching one of the app-requested <a>valid service type</a> tokens that are actively available within the user's current network.
+            </p>
+          </dd>
+        </dl>
+
+        <div>
+           <p>
+              The <dfn id="dom-networkservices-length"><code>length</code></dfn> attribute MUST return the number of services represented in the object's corresponding <a>current authorized services</a> list at the time of getting.
+           </p>
+
+           <p>
+              The <dfn id="dom-networkservices-servicesavailable"><code>servicesAvailable</code></dfn> attribute MUST return the number of services available in the
+              user's network that match the <a>valid service type</a> that was initially used to create the current <a href="#networkservices"><code>NetworkServices</code></a> object.
+           </p>
+
+           <p>
+             When a previously unknown instance of a networked service matching one of the requested <a href="#dfn-valid-service-type">valid service types</a> becomes available on the user's current network, the <a>user agent</a> MUST increment the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute by <code>1</code> and then
+             <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a>
+             to dispatch a newly created event with the name <code>serviceavailable</code> that uses the <code>Event</code> interface, which does
+             not bubble, is not cancellable, and has no default action, at the current <a href="#networkservices"><code>NetworkServices</code></a>
+             object.
+           </p>
+
+           <p>
+             When a previously known instance of a networked service matching one of the requested <a href="#dfn-valid-service-type">valid service types</a> becomes unavailable on the user's current network, the <a>user agent</a> MUST decrement the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute by <code>1</code> and then
+             <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a>
+              to dispatch a newly created event with the name <code>serviceunavailable</code> that uses the <code>Event</code> interface, which does
+              not bubble, is not cancellable, and has no default action, at the current <a href="#networkservices"><code>NetworkServices</code></a>
+              object.
+           </p>
+        </div>
+
+      </section>
+
+      <section>
+      <h2>Methods</h2>
+        <dl class="domintro">
+        <dt>
+          <code title="networkservices-getter">
+            <a href="#networkservices">services</a>
+          </code>
+          [
+          <var title="">index</var>
+          ]
+        </dt>
+        <dd>
+          <p>
+            Returns the specified <a href="#networkservice"><code>NetworkService</code></a> object.
+          </p>
+        </dd>
+        <dt>
+          <code title="networkservices-getter">
+            <a href="#networkservices">services</a>
+          </code>
+          .
+          <code title="dom-networkservices-getservicebyid">
+            <a href="#dom-networkservices-getservicebyid">getServiceById</a>
+          </code>
+          (
+          <var title="">id</var>
+          )
+        </dt>
+        <dd>
+          <p>
+            Returns the <a href="#networkservice"><code>NetworkService</code></a> object with the given identifier, or null if no
+            service has that identifier.
+          </p>
+        </dd>
+      </dl>
+
+      <p>
+        A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current list of zero or more <a>current authorized services</a>, of which zero or more can be available at a time. Each item in <a>current authorized services</a> is represented by a <a href="#networkservice"><code>NetworkService</code></a> object. The list of <a>current authorized services</a> is <span>immutable</span> meaning that it cannot be modified for the lifetime of a <a href="#networkservices"><code>NetworkServices</code></a> object.
+      </p>
+
+      <p class="note">
+        Each service in a <a href="#networkservices"><code>NetworkServices</code></a> object thus has an index; the first has the index 0, and each subsequent service is numbered one higher than the previous one. If the <a>user agent</a> dynamically adds or removes network services for any reason, then the indices of the services in <a>current authorized services</a> will change dynamically. If the set of network services changes entirely, then all the previous services will be removed from <a>current authorized services</a> and replaced with new services.
+      </p>
+
+      <p>
+        The <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#supported-property-indices" class="externalDFN">supported property indices</a> of <a href="#networkservices"><code>NetworkServices</code></a> objects at any instant are the numbers from zero to the number of items in <a>current authorized services</a> represented by the respective object minus one, if any services are represented in <a>current authorized services</a>. If a <a href="#networkservices"><code>NetworkServices</code></a> object represents no <a>current authorized services</a>, it has no <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#supported-property-indices" class="externalDFN">supported property indices</a>.
+      </p>
+
+      <p>
+        To <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#determine-the-value-of-an-indexed-property" class="externalDFN">determine the value of an indexed property</a> for a given index <var>index</var> in a <a href="#networkservices"><code>NetworkServices</code></a> object's <a>current authorized services</a>, the user agent MUST return the <a href="#networkservice"><code>NetworkService</code></a> object that represents the <var>index</var>th service in <a>current authorized services</a>.
+      </p>
+
+      <p>
+        The <dfn id="dom-networkservices-getservicebyid"><code>getServiceById(id)</code></dfn> method MUST return the first <a href="#networkservice"><code>NetworkService</code></a> object in <a>current authorized services</a> represented by the respective object whose <a href="#dom-networkservice-id"><code>id</code></a> attribute is equal to the value of the <var>id</var> argument.
+        When no services in <a>current authorized services</a> match the given argument, the method MUST return null.
+      </p>
+
+      <p>
+         Services available within the local network can connect and disconnect at different times during the execution of a web page. A <a>user agent</a> can
+         inform a web page when the state of networked services matching the requested <a>valid service type</a> change. Web pages can use this information to enable in-page experiences for communicating the state of networked services
+         with the ability to change the particular service or set of services the page is connected to by re-invoking the <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> method.
+      </p>
+
+      </section>
+
+      <section>
+      <h2>Events</h2>
+
+      <p>
+         The following are the event handlers (and their corresponding event handler event types) that must be supported, as IDL attributes, by all objects implementing the <a href="#networkservices"><code>NetworkServices</code></a> interface:
+       </p>
+
+       <table border="1">
+        <thead>
+          <tr>
+            <th>
+              <span title="event handlers">Event handler</span>
+            </th>
+            <th>
+              <span>Event handler event type</span>
+            </th>
+          </tr>
+        </thead>
+        <tbody>
+          <tr>
+            <td>
+              <dfn id="dom-networkservices-onserviceavailable" title="dom-NetworkServices-onserviceavailable">
+                <code>onserviceavailable</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-serviceavailable">serviceavailable</code>
+            </td>
+          </tr>
+          <tr>
+            <td>
+              <dfn id="dom-networkservices-onserviceunavailable" title="dom-NetworkServices-onserviceunavailable">
+                <code>onserviceunavailable</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-serviceunavailable">serviceunavailable</code>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+
+      <p>
+         Events with an event type of <code>serviceavailable</code> or <code>serviceunavailable</code> defined in this specification are simple <code>Event</code> objects.
+      </p>
+
+      </section>
+
+    </section>
+    <section>
+    <h2>Communicating with a networked service</h3>
+
+<p>
+   The <a href="#networkservice"><code>NetworkService</code></a> interface is used to provide a set of connection information for an HTTP service endpoint and if available, service events, running on a networked device.
+</p>
+
+<pre class="widl">
+[NoInterfaceObject]
+interface <dfn id="networkservice">NetworkService</dfn> {
+  readonly attribute DOMString        <a href="#dom-networkservice-id">id</a>;
+  readonly attribute DOMString        <a href="#dom-networkservice-name">name</a>;
+  readonly attribute DOMString        <a href="#dom-networkservice-type">type</a>;
+  readonly attribute DOMString        <a href="#dom-networkservice-url">url</a>;
+  readonly attribute DOMString        <a href="#dom-networkservice-config">config</a>;
+
+  readonly attribute boolean          <a href="#dom-networkservice-online">online</a>;
+
+  // event handler attributes
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservice-onserviceonline">onserviceonline</a>;
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservice-onserviceoffline">onserviceoffline</a>;
+
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservice-onnotify">onnotify</a>;
+};
+
+<a href="#networkservice">NetworkService</a> implements <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-eventtarget" class="externalDFN">EventTarget</a>;
+</pre>
+
+<section>
+  <h2>Attributes</h2>
+
+      <dl class="domintro">
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-id">
+            <a href="#dom-networkservice-id">id</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            A unique identifier for the given user-selected service instance.
+          </p>
+        </dd>
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-name">
+            <a href="#dom-networkservice-name">name</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            The name of the user-selected service.
+          </p>
+        </dd>
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-type">
+            <a href="#dom-networkservice-type">type</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            The <a>valid service type</a> token value of the user-selected service.
+          </p>
+        </dd>
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-url">
+            <a href="#dom-networkservice-url">url</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            The control URL endpoint (including any required port information) of the user-selected control service that has been added to the <a>entry script origin's URL whitelist</a>.
+          </p>
+        </dd>
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-config">
+            <a href="#dom-networkservice-config">config</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            The configuration information associated with the service depending on the requested service type.
+          </p>
+        </dd>
+      </dl>
+
+          <p>
+            The <dfn id="dom-networkservice-id"><code>id</code></dfn> attribute is a unique identifier for the service. The same service provided at different times or on different objects MUST have the same <a href="#dom-networkservice-id"><code>id</code></a> value.
+         </p>
+
+         <p>
+            The <dfn id="dom-networkservice-name"><code>name</code></dfn> attribute represents a human-readable title for the service.
+         </p>
+
+         <p>
+             The <dfn id="dom-networkservice-type"><code>type</code></dfn> attribute reflects the value of the <a>valid service type</a> of the service.
+          </p>
+
+         <p>
+            The <dfn id="dom-networkservice-url"><code>url</code></dfn> attribute is an <a href="http://www.w3.org/TR/html5/urls.html#absolute-url" class="externalDFN">absolute URL</a> pointing to the root HTTP
+            endpoint for the service that has been added to the <a>entry script origin's URL whitelist</a>. Web pages can subsequently use this value for implicit cross-document messaging via various existing mechanisms (e.g. Web Sockets, Server-Sent Events, Web Messaging, XMLHttpRequest).
+         </p>
+
+         <p>
+            The <dfn id="dom-networkservice-config"><code>config</code></dfn> attribute provides the raw configuration information extracted from the given network service.
+         </p>
+
+      </section>
+
+      <section>
+         <h3>States</h3>
+
+      <dl class="domintro">
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-online">
+            <a href="#dom-networkservice-online">online</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            Returns <code>true</code> if the service is reporting that it is accessible on the local network or <code>false</code> if the service is reporting that it is no longer accessible (temporarily or permanently) on the local network.
+          </p>
+        </dd>
+      </dl>
+
+      <p>
+        The <dfn id="dom-networkservice-online"><code>online</code></dfn> attribute indicates whether the service is reporting itself as being
+        either <var>online</var>, and therefore accessible on the local network, in which case this attribute will return <code>true</code> or, <var>offline</var>, and therefore not accessible on the local network, either temporarily or permanently, in which case this attribute will return <code>false</code>. This attribute MUST default to <code>true</code>.
+      </p>
+
+      </section>
+
+      <section>
+         <h3>Events</h3>
+
+      <p>
+         The following are the event handlers (and their corresponding event handler event types) that must be supported, as IDL attributes, by all objects implementing the
+         <a href="#networkservice"><code>NetworkService</code></a> interface:
+       </p>
+
+       <table border="1">
+        <thead>
+          <tr>
+            <th>
+              <span title="event handlers">Event handler</span>
+            </th>
+            <th>
+              <span>Event handler event type</span>
+            </th>
+          </tr>
+        </thead>
+        <tbody>
+          <tr>
+            <td>
+              <dfn id="dom-networkservice-onnotify" title="dom-NetworkService-onnotify">
+                <code>onnotify</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-notify">notify</code>
+            </td>
+          </tr>
+          <tr>
+            <td>
+              <dfn id="dom-networkservice-onserviceonline" title="dom-NetworkService-onserviceonline">
+                <code>onserviceonline</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-onserviceonline">serviceonline</code>
+            </td>
+          </tr>
+          <tr>
+            <td>
+              <dfn id="dom-networkservice-onserviceoffline" title="dom-NetworkService-onserviceoffline">
+                <code>onserviceoffline</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-onserviceoffline">serviceoffline</code>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+
+      <p>
+         Events with an event type of <code>notify</code>, <code>serviceonline</code> or <code>serviceoffline</code> defined in this specification are simple <code>Event</code> objects.
+      </p>
+
+      </section>
+   </section>
+
+      <section>
+            <h2>Service Discovery</h2>
+
+      <p>
+         A <a>user agent</a> conforming to this specification MAY implement <acronym title="Simple Service Discovery Protocol">SSDP</acronym> [[!UPNP-DEVICEARCH11]] and Zeroconf [[!DNS-SD]] + [[!MDNS]] service discovery mechanisms
+         to enable Web pages to request and connect with HTTP services running on networked devices, discovered via either mechanism, through this API. When a <a>user agent</a> implements either of these service discovery mechanisms, then it MUST conform to the corresponding algorithms provided in this section of the specification.
+      </p>
+      <p>
+         This section presents how the results of these two service discovery
+         mechanisms will be matched to requested service types and how their properties will be applied to any resulting <a href="#networkservice"><code>NetworkService</code></a> objects.
+      </p>
+
+      <p>
+         It is expected that user agents will perform these service discovery mechansisms asynchronously and periodically update the <a>list of networked devices</a> as required. The timing of any
+         service discovery mechanisms is an implementation detail left to the discretion of the implementer (e.g. once on user agent start-up, every X seconds during user agent execution or on
+         invocation of this API from a Web page).
+      </p>
+
+      <p>
+         The <dfn>list of available service records</dfn> is a single dynamic internal lookup table within user agents that is used to track the current services available in the network at any given time.
+         At any point during the running of either of the two service discovery mechanisms then existing entries within this table can be updated, entries can be added and entries can be removed as the status of networked
+         services changes. Each record contained within this table contains the attributes: <code>id</code>, <code>name</code>, <code>type</code>, <code>url</code> and <code>config</code>.
+      </p>
+
+            <section>
+         <h4>Zeroconf (<abbr title="Multicast DNS">mDNS</abbr> + <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr>)</h4>
+
+         <p>
+            For each DNS response received from a user-agent-initiated Multicast DNS Browse for <abbr title="DNS Pointer Record">PTR</abbr> records with the name <code>_services._dns-sd._udp</code> on the resolved recommended automatic browsing
+   domain [[!MDNS]], the <a>user agent</a> MUST run the following steps:
+         </p>
+
+         <ol class="rule">
+
+            <li>Let <var>service mDNS responses</var> be an array of PTR records received by issuing a Multicast DNS Browse for PTR records with the name of the current discovered service type.</li>
+
+            <li>For each Object <var>service mDNS response</var> in <var>service mDNS responses</var>, run the following steps:
+               <ol>
+
+                  <li>
+                     Let <var>network service record</var> be an Object consisting of the following empty properties: <code>id</code>, <code>name</code>, <code>type</code>, <code>url</code>, <code>config</code>.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>id</code> property to the value of the full PTR Service Instance Name [[!MDNS]].
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>name</code> property to the value of the PTR Service Instance Name's <var>Instance</var> component [[!MDNS]].
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>type</code> property to the concatenation of the string <code>zeroconf:</code> followed by the value of the PTR Service Instance Name's <var>Service</var> component [[!MDNS]].
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>url</code> property to the resolvable Service URL obtained from performing an DNS-SD Lookup [[!DNS-SD]] of the current service from the PTR record provided [[!MDNS]].
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>config</code> property to the string value of the contents of the first DNS-SD TXT record associated with the <var>service mDNS response</var> as defined in [[!DNS-SD]].
+                  </li>
+
+                  <li>
+                     For each Object <var>existing service record</var> in the current <a>list of available service records</a>, run the following sub-steps:
+                     <ol class="rule">
+
+                       <li>
+                        If the <var>existing service record</var>'s <code>id</code> property matches the value of the <var>network service record</var>'s <code>id</code>, then set the
+                        value of <var>existing service record</var> in the current <a>list of available service records</a>  to the value of the
+                        <var>network service record</var> and skip the next step.
+                       </li>
+                     </ol>
+                  </li>
+
+                  <li>
+                     Add <var>network service record</var> to the <a>list of available service records</a>.
+                  </li>
+
+                  <li>
+                     For each non-garbage collected <a href="#networkservice"><code>NetworkService</code></a> object run the following steps:
+
+                     <ol class="rule">
+                        <li>
+                           If the <a href="#networkservice"><code>NetworkService</code></a> object's <code>type</code> attribute does not equal the
+                           current <a>network service record</a>'s <code>type</code> property then continue at the next available active
+                           <a href="#networkservice"><code>NetworkService</code></a> object.
+                        </li>
+                        <li>
+                           Increment the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute of the <a href="#networkservices"><code>NetworkServices</code></a> object by <code>1</code>.
+                        </li>
+                        <li>
+                          <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">Queue a task</a>
+                           to dispatch a newly created event with the name <code>serviceavailable</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
+                            <a href="#networkservices"><code>NetworkServices</code></a> object.
+                        </li>
+                        <li>
+                          <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">Queue a task</a>
+                           to dispatch a newly created event with the name <code>serviceonline</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
+                           <a href="#networkservice"><code>NetworkService</code></a> object.
+                        </li>
+                     </ol>
+                  </li>
+            </ol>
+           </li>
+         </ol>
+
+      </section>
+
+      <section>
+         <h5>Universal Plug-and-Play (<abbr title="Universal Plug-and-Play">UPnP</abbr>)</h5>
+
+         <p>
+            For each SSDP Presence Announcement [[!UPNP-DEVICEARCH11]] - a HTTP NOTIFY request - received from a user-agent-initiated SSDP Discovery Request [[!UPNP-DEVICEARCH11]], the <a>user agent</a> MUST run the following steps:
+         </p>
+
+         <ol class="rule">
+            <li>
+               Let <var>ssdp device</var> be an Object with a property for each HTTP header received in the received SSDP Presence Announcement, with each key being the name of a HTTP header and its
+               value being that HTTP header's accompanying value.
+            </li>
+
+            <li>
+               If <var>ssdp device</var> does not contain at least one <var>NTS</var>, <var>USN</var> and <var>Location</var> parameter, then the <a>user agent</a> MUST abort these steps.
+            </li>
+
+            <li>
+               If the first occurrence of <var>NTS</var> has a value other than <code>ssdp:alive</code>, then continue to the step labeled <var>update service monitor</var> below.
+            </li>
+
+            <li>
+               Let <var>root device descriptor file</var> contain the contents of the file located at the URL provided in the first occurrence of <var>Location</var> obtained according to the rules
+               defined in the section 'Retrieving a description using HTTP' [[!UPNP-DEVICEARCH11]].
+            </li>
+
+            <li>
+               If <var>root device descriptor file</var> is empty, then the <a>user agent</a> MUST abort these steps.
+            </li>
+
+            <li>
+               Let <var>advertised services</var> be a <a>list of all advertised services</a> obtained from the <var>root device descriptor file</var> containing all sub-nodes of the <code>serviceList</code> node as described in
+               the section 'Device Description' [[!UPNP-DEVICEARCH11]].
+            </li>
+
+            <li>
+               For each Object <var>advertised service</var> in <var>advertised services</var> run the following steps:
+               <ol class="rule">
+
+                  <li>
+                     Let <var>network service record</var> be an Object consisting of the following empty properties: <code>id</code>, <code>name</code>, <code>type</code>, <code>url</code>, <code>eventsUrl</code>, <code>config</code>.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>id</code> property to the string value of the first occurrence of <var>ssdp device</var>'s <var>USN</var> parameter.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>name</code> property to the string value of the first occurrence of the <var>service</var>'s <code>serviceId</code> property.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>type</code> property to the concatenation of the string <code>upnp:</code> followed by the string value of the first occurrence of the <var>service</var>'s <code>serviceType</code> property.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>url</code> property to the string value of the first occurrence of the <var>service</var>'s <code>controlURL</code> property.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>config</code> property to the string value of the first occurrence of the <var>device</var> property.
+                  </li>
+
+                  <li>
+                     If <var>service</var>'s <code>eventSubURL</code> property is empty, then continue to the step labeled <em>register</em> below.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>eventsUrl</code> property to the string value of the first occurrence of the <var>service</var>'s <code>eventSubURL</code> property.
+                  </li>
+
+                  <li>
+                     <em>Register</em>: For each Object <var>existing service record</var> in the current <a>list of available service records</a>, run the following sub-steps:
+                     <ol class="rule">
+
+                       <li>
+                        If the <var>existing service record</var>'s <var>id</var> property matches the value of the first occurrence of <var>USN</var> and the
+                        <var>existing service record</var>'s <code>type</code> property matches the value of <var>network service record</var>'s <code>type</code>, then set the
+                        value of <var>existing service record</var> in the current <a>list of available service records</a>  to the value of the
+                        <var>network service record</var> and skip the next step.
+                       </li>
+                     </ol>
+                  </li>
+
+                  <li>
+                     Add <var>network service record</var> to the <a>list of available service records</a>.
+                  </li>
+
+               </ol>
+            </li>
+            <li>
+               <em>Update Service Monitor</em>: For each non-garbage collected <a href="#networkservice"><code>NetworkService</code></a> object run the following steps:
+
+               <ol class="rule">
+                  <li>
+                     If this <a href="#networkservice"><code>NetworkService</code></a> object's <code>type</code> attribute does not equal the
+                     current <a>network service record</a>'s <code>type</code> property then continue at the next available active
+                     <a href="#networkservice"><code>NetworkService</code></a> object.
+                  </li>
+                  <li>
+                     If the <var>announcement type</var> equals <code>ssdp:alive</code> then increment the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute of the <a href="#networkservices"><code>NetworkServices</code></a>
+                     object by <code>1</code> and then <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a>
+                      to dispatch a newly created event with the name <code>serviceavailable</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
+                      <a href="#networkservice"><code>NetworkServices</code></a> object. Otherwise, decrement the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute of the <a href="#networkservices"><code>NetworkServices</code></a>
+                     object by <code>1</code> and then  <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a>
+                       to dispatch a newly created event with the name <code>serviceunavailable</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
+                       <a href="#networkservice"><code>NetworkServices</code></a> object.
+                  </li>
+                  <li>
+                     If the <var>announcement type</var> equals <code>ssdp:alive</code> then <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a>
+                      to dispatch a newly created event with the name <code>serviceonline</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
+                      <a href="#networkservice"><code>NetworkService</code></a> object. Otherwise, <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a>
+                       to dispatch a newly created event with the name <code>serviceoffline</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
+                       <a href="#networkservice"><code>NetworkService</code></a> object.
+                  </li>
+               </ol>
+            </li>
+         </ol>
+
+         <p>
+            A <dfn>user-agent generated callback url</dfn> is a Local-network accessible URL endpoint that a <a>user agent</a> must generate and maintain for receiving HTTP NOTIFY requests from UPnP Event sources.
+         </p>
+
+         <p>When the <a>user agent</a> is to <dfn>setup a UPnP Events Subscription</dfn>, it is to run the following steps with the current <var>network service record</var> object:</p>
+
+         <ol class="rule">
+            <li>
+               If <var>network service record</var>'s <code>eventsUrl</code> property is empty then the <a>user agent</a> MUST abort these steps.
+            </li>
+
+            <li>
+               Let <var>callback URL</var> be the value of creating a new <a>user-agent generated callback url</a>.
+            </li>
+
+            <li>
+               Send a HTTP SUBSCRIBE request with a <em>NT</em> header with a string value of <code>upnp:event</code>, a <em>TIMEOUT</em> header with an integer value ofƒ
+               <code>86400</code> and a <em>CALLBACK</em> header
+               with a string value of <var>callback URL</var> towards the <var>network service record</var>'s <code>eventsUrl</code> property.
+            </li>
+
+            <li>
+               If a non-200 OK response is received from the HTTP SUBSCRIBE request then the <a>user agent</a> MUST abort these steps.
+            </li>
+
+            <li>
+               On receiving a valid 200 OK response, run the following steps:
+
+               <ol class="rule">
+                  <li>
+                     Let <var>callback ID</var> equal the string value of the first included <em>SID</em> header, if it exists.
+                  </li>
+                  <li>
+                     Let <var>timeout date</var> equal the sum of the current UTC date value plus the integer value of the first included <em>TIMEOUT</em> header, if it exists.
+                  </li>
+                  <li>
+                     Run the following steps aynchronously and continue to the step labeled <em>listen</em> below.
+                  </li>
+                  <li>
+                     <em>Refresh Subscription</em>: Run the following steps at a set interval (X) within the <a>user agent</a>:
+
+                     <ol class="rule">
+                        <li>
+                           Let <var>current date</var> equal the current UTC date.
+                        </li>
+                        <li>
+                           If <var>current date</var> is less than the <var>timeout date</var> then continue to the step labeled <em>refresh subscription</em> above.
+                        </li>
+                        <li>
+                           Send a HTTP SUBSCRIBE request with a <em>SID</em> header with the string value of <var>callback ID</var> and a <em>TIMEOUT</em> header
+                           with an integer value of <code>86400</code> towards the <var>network service record</var>'s <code>eventsUrl</code> property.
+                        </li>
+                        <li>
+                           On receiving a valid 200 OK, update <var>callback ID</var> with the string value of the first included <em>SID</em> header, if it exists. All other HTTP
+                           responses should cause the <a>user agent</a> to continue from the step labeled <em>refresh subscription</em> above.
+                        </li>
+                     </ol>
+
+                  </li>
+
+                  <li>
+                     <em>Listen</em>: For each HTTP NOTIFY request received at the <var>callback URL</var> the <a>user agent</a> is to run the following steps:
+
+                     <ol class="rule">
+                        <li>
+                           Let <var>content clone</var> be the result of obtaining the message body of the HTTP NOTIFY request. If <var>content clone</var> is empty, then the <a>user agent</a> MUST abort these steps.
+                        </li>
+                        <li>
+                          Let <var>notification event</var> be a new simple event that uses the <code>Event</code> interface with the name <code>notify</code>,
+                           which does not bubble, is not cancellable, and has no default action.
+                        </li>
+                        <li>
+                           Let the <code>data</code> attribute of <var>notification event</var> have the DOMString value of <var>content clone</var>.
+                        </li>
+                        <li>
+                           <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">Queue a task</a> to
+                            dispatch <var>notification event</var> at the current <a><code>NetworkService</code></a> object.
+                        </li>
+                     </ol>
+                  </li>
+
+               </ol>
+
+            </li>
+         </ol>
+
+         </section>
+
+         <section>
+            <h3>Network Topology Monitoring</h3>
+
+                  <div>
+                     <p>
+                        When the <a>user agent</a> detects that the user has dropped from their connected network, then it MUST run the following steps:
+                     </p>
+
+                     <ol class="rule">
+                        <li>
+                           Flush all entries from the <a>list of available service records</a>.
+                        </li>
+                        <li>
+                           For each <a href="#networkservice"><code>NetworkService</code></a> object currently active in the <a>user agent</a> perform the following steps:
+
+                           <ol class="rule">
+                              <li>
+                                 Set the <a href="#dom-networkservice-online"><code>online</code></a> attribute to <code>false</code>.
+                              </li>
+                              <li>
+                                 <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">Queue a task</a>
+                                                      to dispatch a newly created event with the name <code>serviceoffline</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
+                                                      <a href="#networkservice"><code>NetworkService</code></a> object.
+                           </ol>
+                        </li>
+                        <li>
+                          For each <a href="#networkservices"><code>NetworkServices</code></a> object currently active in the <a>user agent</a> perform the following steps:
+
+                          <ol class="rule">
+                            <li>
+                              Let <var>number of available services</var> equal the value of <a href="#networkservices"><code>NetworkServices</code></a>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute.
+                            </li>
+                            <li>
+                              Set the <a href="#networkservices"><code>NetworkServices</code></a>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute to zero (<code>0</code>).
+                            </li>
+                            <li>
+                              For each <var>available service</var> in <var>number of available services</var> the <a>user agent</a> MUST fire a new simple event with the name <code>serviceunavailable</code> that has no default action, does not bubble and is not cancellable, at the current <a href="#networkservices"><code>NetworkServices</code></a> object.
+                            </li>
+                          </ol>
+                        </li>
+
+                     </ol>
+
+                     <p>
+                        When the <a>user agent</a> detects that the user has connected to a new network, then it SHOULD run the following steps:
+                     </p>
+
+                     <ol class="rule">
+                        <li>
+                           Re-issue an mDNS search and SSDP discovery search using all of the <a>valid service type</a> tokens initially provided to all active <a href="#networkservices"><code>NetworkServices</code></a> objects and handle all discovery responses according to the processing defined in <a href="#service-discovery">Section 7: Service Discovery</a>.
+                        </li>
+                     </ol>
+                  </div>
+         </section>
+      </section>
+
+   <section>
+      <h3>Garbage collection</h3>
+
+      <p>
+         A <a><code>NetworkService</code></a> object containing a <code>url</code> parameter currently in the <a>entry script origin's URL whitelist</a> MUST NOT be garbage collected.
+      </p>
+
+      <p>
+         Only when the user navigates away from the current browsing context can <a><code>NetworkService</code></a> objects be garbage-collected and records in the <a>entry script origin's URL whitelist</a> be removed.
+      </p>
+
+   </section>
+
+
+    <section>
+      <h3>Use Cases and Requirements</h3>
+
+      <p>This section covers what the requirements are for this API, as well as illustrates some use cases.</p>
+
+      <ul class="rule">
+         <li>
+            Once a user has given permission, user agents should provide the ability for Web pages to communicate directly with a Local-networked Service.
+            <ul class="rule">
+               <li>
+                  Example: A web-based TV remote control. A Web page wants to control the current user's TV, changing the programming shown or increasing/decreasing/muting the
+                  volume of the Local-networked Device. The Web page requests a service type that is known to be implemented by television sets to which it has the
+                  application logic to communicate. Local devices providing the request service types are discovered and presented to the user for authorization. The user selects one
+                  or more of the discovered television sets to be accessible to the current Web page and then clicks 'Share'. The Web page can now communicate directly with
+                  the user-authorized Local-networked services.
+               </li>
+            </ul>
+         </li>
+
+         <li>
+           Web pages should be able to communicate with Local-networked Services using the messaging channel supported by those Devices.
+           <ul class="rule">
+            <li>
+               Example: A Web page advertises that it is capable of controlling multiple Home Media Servers. The user can select their Home Media Server type from a drop-down list, at which point the
+               Web page sends a request to the user agent to connect with the associated service type of the Home Media Server. The Media Server selected implements a Web Socket channel for
+               bi-directional service communication and so the Web page opens a web socket to the requested Media Server and can communicate as required via that appropriate channel.
+            </li>
+           </ul>
+         </li>
+
+         <li>
+           Web pages should be able to communicate with Local-networked Services using the messaging format supported by those Devices.
+           <ul class="rule">
+            <li>
+               Example: A Web page advertises that it is capable of interacting with and controlling multiple types of Home Media Server. The user can select their Home Media Server type from a drop-down list or known Media Servers, at which point the
+               Web page sends a request to the user agent to connect with the associated service type (and, optionally, the associated event type) of the Home Media Server. The communiciation protocols supported by Home Media Servers typically vary
+               between UPnP, JSON-RPC, Protocol Buffers or other messaging formats depending on the Home Media Server requested. The Web page is able to communicate with the user-selected Home Media
+               Server in the messaging format supported by that Device, which, in this example is a simple key/value pair text format.
+            </li>
+           </ul>
+         </li>
+
+         <li>
+           Web pages should not be able to communicate with Local-networked Services that have not been authorized by the user thereby maintaining the user's privacy.
+           <ul class="rule">
+            <li>
+               Example: A Web page requests access to one type of Local-networked service. The user authorizes access to that particular service. Other services running on that same device, and on other devices
+               within the network, should not be accessible to the current Web page.
+            </li>
+           </ul>
+         </li>
+
+         <li>
+           A user should be able to share one or more Local-networked Services based on a particular service type request from a Web page.
+           <ul class="rule">
+            <li>
+               Example: A Web page is capable of interacting with a specific profile of Local-networked Service. As such, it makes a request to the user agent to access those services, of which multiple matches
+               are found. The user is capable of selecting one or more of the discovered services to share with the Web page. The Web page can then implement a drag-and-drop interface for the user to drag specific
+               actions on to one or more of the authorized Local-networked Services.
+            </li>
+           </ul>
+         </li>
+
+         <li>
+           User agents should provide an API exposed to script that exposes the features above. The user is notified by UI anytime interaction with Local-networked Services is requested, giving the user
+           full ability to cancel or abort the transaction. The user selects the Local-networked Services to be connected to the current Web page, and can cancel these at any time. No invocations to
+           these APIs occur silently without user intervention.
+         </li>
+      </ul>
+    </section>
+
+          <section class="informative appendix">
+             <h3>Examples</h3>
+
+           <div class="example">
+            <p>This sample code exposes a button. When clicked, this button is disabled and the user is prompted to offer a network service. The user may also select multiple network services. When the user has authorized a network service to be connected to the web page then the web page issues a simple command to get a list of all the albums stored on the connected media player service.
+            <p>The button is re-enabled only when the connected network service disconnects for whatever reason (the service becomes unavailable on the network, the user disconnects from their current network or the user revokes access to the service from the current web page). At this point the user can re-click the button to select a new network service to connect to the web page and the above steps are repeated.</p>
+            <p>The provided service type identifier and service interaction used in this example is based on the well-defined service type and messaging format supported by the <a href="http://xbmc.org/about/">XBMC Media Server</a>. </p>
+            <hr />
+            <pre class="highlight">&lt;input type="button" value="Start" onclick="start()" id="startBtn"/&gt;
+&lt;div id="debugconsole">&lt;/div>
+
+&lt;script>
+ var startBtn = document.getElementById('startBtn'),
+     debug = document.getElementById('debugconsole');
+
+ function start() {
+   if(navigator.getNetworkServices) {
+      navigator.getNetworkServices('zeroconf:_xbmc-jsonrpc._tcp', gotXBMCService, error);
+      startBtn.disabled = true;
+   } else {
+      debug.innerHTML += "&lt;br&gt;Service Discovery not supported!";
+   }
+ }
+
+ function gotXBMCService(services) {
+
+// Listen for service disconnect messages
+
+   services[0].addEventListener('serviceoffline', function ( e ) {
+       debug.innerHTML += "&lt;br>" + services[0].name + " disconnected.";
+       startBtn.disabled = false;
+   }, false);
+
+// Send a service message to get albums list (and process the service response)
+
+   var svcXhr = new XMLHttpRequest();
+   svcXhr.open("POST", services[0].url + "/getAlbums"); // services[0].url and its subresources have been
+                                                        // whitelisted for cross-site XHR use in this
+                                                        // current browsing context.
+
+   svcXhr.setRequestHeader('Content-Type', 'application/json-rpc');
+
+   svcXhr.addEventListener('readystatechange', function ( response ) {
+     if( response.readyState != 4 || response.status != 200 )
+        return;
+     debug.innerHTML += "&lt;br>" + services[0].name + " response received: ";
+     debug.textContent += JSON.parse(response.responseText);
+   }, false);
+
+   var svcMsg = [
+     { "jsonrpc": "2.0", "method": "AudioLibrary.GetAlbums", "params": { "genreid": -1,
+         "artistid": -1, "start": -1, "end": -1 }, "id": "1" }
+   ];
+
+   svcXhr.send(JSON.stringify(svcMsg));
+   debug.innerHTML += "&lt;br>" + services[0].name + " request sent: ";
+   debug.textContent += JSON.stringify(svcMsg);
+
+ }
+
+ function error( err ) {
+   debug.innerHTML += "&lt;br>An error occurred obtaining a local network service.";
+   startBtn.disabled = false;
+ }
+&lt;/script></pre>
+           </div>
+
+           <div class="example">
+            <p>
+             This sample exposes a drop-down list containing a number of common Home-based audio devices. When the user selects an audio device from the list provided, they are prompted to authorize a network service
+             based on the service type requested. The user may also select multiple network services matching the selected service type.
+             In this example, the user selects their make as being <var>Sony</var> and their model as being <var>Bravia S1000</var> from which the Web page can derive a service type
+             (<var>urn:schemas-upnp-org:service:RenderingControl:1</var>).
+             <br /><br />Once the user has authorized the device, the web page sends a simple mute command according to the messaging format supported by the device.
+            </p>
+            <hr />
+            <pre class="highlight">&lt;select name="make" id="make"&gt;
+  &lt;option selected="selected" disabled="disabled"&gt;Select make&lt;/option&gt;
+  &lt;option&gt;Sony&lt;/option&gt;
+  &lt;option&gt;Philips&lt;/option&gt;
+  &lt;option&gt;Alba&lt;/option&gt;
+&lt;/select&gt;
+&lt;select name="model" id="model"&gt;&lt;/select&gt;
+&lt;div id="debugconsole"&gt;&lt;/div&gt;
+
+&lt;script&gt;
+  var debug = document.getElementById('debugconsole');
+
+  var models = {
+    "Sony": [
+      {"name": "Bravia TV S1000", "type": "upnp", "service": "urn:schemas-upnp-org:service:RenderingControl:1" },
+      {"name": "Bravia TV S2000", "type": "zeroconf", "service": "_mediarenderer._http._tcp" },
+      {"name": "HiFi WD10", "type": "upnp", "service": "urn:schemas-upnp-org:service:RenderingControl:1" }
+    ],
+    "Philips": [ /* ... */ ],
+    "Alba": [ /* ... */ ]
+  };
+
+  var makeEl = document.getElementById("make"),
+      modelEl = document.getElementById("model");
+
+  makeEl.addEventListener('change', function() {
+    modelEl.innerHTML = ""; // reset
+    var defaultOption = document.createElement("option");
+    defaultOption.textContent = "Select model";
+    defaultOption.setAttribute("disabled", "disabled");
+    defaultOption.setAttribute("selected", "selected");
+    modelEl.appendChild(defaultOption);
+    for(var i = 0, l = models[makeEl.value].length; i < l; i++) {
+      var option = document.createElement("option");
+      option.textContent = models[makeEl.value][i]["name"];
+      option.setAttribute("value", models[makeEl.value][i]["type"] + ":" + models[makeEl.value][i]["service"]);
+      modelEl.appendChild(option);
+    }
+  }, false);
+
+  modelEl.addEventListener('change', function() {
+    if(navigator.getNetworkServices &&
+         modelEl.value == "upnp:urn:schemas-upnp-org:service:RenderingControl:1") {
+      navigator.getNetworkServices(modelEl.value, successCallback, errorCallback);
+    } else if (modelEl.value == "zeroconf:_mediarenderer._http._tcp") {
+      debug.innerHTML += "&lt;br&gt;Service type is not implemented by this application.";
+    } else {
+      debug.innerHTML += "&lt;br&gt;Service Discovery is not supported!";
+    }
+  }, false);
+&lt;/script&gt;
+
+&lt;script&gt;
+  function successCallback( services ) {
+
+  // Listen for service push notification messages
+
+    services[0].addEventListener('notify', function ( msg ) {
+         debug.innerHTML += "&lt;br>" + services[0].name + " event received: ";
+         debug.textContent += msg.data;
+    }, false);
+
+ // Send a control signal to mute the service audio
+
+    var svcXhr = new XMLHttpRequest();
+    svcXhr.open("POST", services[0].url); // services[0].url and its
+                                          // subresources have been whitelisted for
+                                          // cross-site XHR use in this current
+                                          // browsing context.
+
+    svcXhr.setRequestHeader('SOAPAction', 'urn:schemas-upnp-org:service:RenderingControl:1#SetMute');
+    svcXhr.setRequestHeader('Content-Type', 'text/xml; charset="utf-8";');
+
+    svcXhr.onreadystatechange = function ( response ) {
+      if( response.readyState != 4 || response.status != 200 )
+        return;
+      debug.innerHTML += "&lt;br&gt;" + services[0].name + " response received: ";
+      debug.textContent += response.responseXML;
+    }
+
+    // Service messaging to mute the provided service
+    var svcMsg = '&lt;?xml version="1.0" encoding="utf-8"?&gt;' +
+                 '&lt;s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" ' +
+                   'xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;' +
+                   '&lt;s:Body&gt;' +
+                     '&lt;u:SetMute xmlns:u="urn:schemas-upnp-org:service:RenderingControl:1"&gt;' +
+                       '&lt;InstanceID&gt;0&lt;/InstanceID&gt;' +
+                       '&lt;Channel&gt;Master&lt;/Channel&gt;' +
+                       '&lt;DesiredMute&gt;true&lt;/DesiredMute&gt;' +
+                     '&lt;/u:SetMute&gt;' +
+                   '&lt;/s:Body&gt;' +
+                 '&lt;/s:Envelope&gt;';
+
+    svcXhr.send(svcMsg);
+    debug.innerHTML += "&lt;br&gt;" + services[0].name + " request sent: ";
+    debug.textContent += svcMsg;
+  }
+
+  function errorCallback( error ) {
+    debug.innerHTML += "&lt;br&gt;An error occurred: " + error.code;
+  }
+&lt;/script&gt;</pre>
+          </div>
+
+       </section>
+
+    <section>
+      <h3>Acknowledgements</h3>
+
+      <p>Thanks are expressed by the editor to the following individuals for their feedback on this specification to date (in alphabetical order):
+      <br /><br />
+      Gar Bergstedt, Lars-Erik Bolstad, Cathy Chan, Hari G Kumar, Bob Lund, Giuseppe Pascale, Marcin Simonides, Clarke Stevens, Christian S&ouml;derstr&ouml;m, Mark Vickers, ...</p>
+
+      <p>Thanks are also expressed by the editor to the following organizations and groups for their support in producing this specification to date (in alphabetical order):
+      <br /></br />
+      CableLabs, Opera Software ASA, W3C Device APIs Working Group, W3C Web and TV Interest Group, ...</p>
+    </section>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gallery/FPWD.html	Mon Sep 03 15:35:05 2012 +0200
@@ -0,0 +1,971 @@
+<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>
+<html lang="en" dir="ltr">
+<head>
+    <title>Pick Media Intent</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    
+    
+  <style type="text/css">/*****************************************************************
+ * 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 type="text/css">/* --- EXAMPLES --- */
+div.example-title {
+    min-width: 7.5em;
+    color: #b9ab2d;
+}
+div.example-title span {
+    text-transform: uppercase;   
+}
+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 }
+div.example {
+    padding: .5em;
+    border-left-width: .5em;
+    border-left-style: solid;
+    border-color: #e0cb52;
+    background: #fcfaee;    
+}
+</style><style type="text/css">/* --- 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 type="text/css">/* 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 type="text/css">/* --- 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 href="http://www.w3.org/StyleSheets/TR/W3C-WD" rel="stylesheet"></head>
+  <body><div class="head">
+  <p>
+    
+      <a href="http://www.w3.org/"><img src="http://www.w3.org/Icons/w3c_home" alt="W3C" height="48" width="72"></a>
+    
+  </p>
+  <h1 class="title" id="title">Pick Media Intent</h1>
+  
+  <h2 id="w3c-working-draft-12-july-2012"><abbr title="World Wide Web Consortium">W3C</abbr> Working Draft 12 July 2012</h2>
+  <dl>
+    
+      <dt>This version:</dt>
+      <dd><a href="http://www.w3.org/TR/2012/WD-gallery-20120712/">http://www.w3.org/TR/2012/WD-gallery-20120712/</a></dd>
+      <dt>Latest published version:</dt>
+      <dd><a href="http://www.w3.org/TR/gallery/">http://www.w3.org/TR/gallery/</a></dd>
+    
+    
+      <dt>Latest editor's draft:</dt>
+      <dd><a href="http://w3c-test.org/dap/gallery/">http://w3c-test.org/dap/gallery/</a></dd>
+    
+    
+    
+    
+    
+    
+    <dt>Editors:</dt>
+    <dd><span>송정기(Jungkee Song)</span>, <a href="http://www.samsung.com/sec/">Samsung Electronics Co., Ltd.</a></dd>
+<dd><a href="http://wonsuk73.com/">이원석(Wonsuk Lee)</a>, <a href="http://www.samsung.com/sec/">Samsung Electronics Co., Ltd.</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>
+    <div class="introductory section" id="abstract"><h2>Abstract</h2>
+      <p>
+        The Pick Media Intent defines a Web Intent [<cite><a href="#bib-WEBINTENTS" class="bibref">WEBINTENTS</a></cite>] that enables
+         access to a user's media gallery from inside a Web application. It 
+         defines both an Intent action/type pair that selects this operation, 
+         and the format of the media data that is returned by services implementing this specification.
+      </p>
+    </div><div id="sotd" class="introductory section"><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>
+        This document recasts the previous pure JavaScript APIs version as an API built using Web Intents, while refining the metadata format based on related media data definitions and practical web-based media services.
+      </p>
+    
+        <p>
+          This document was published by the <a href="http://www.w3.org/2009/dap/">Device APIs Working Group</a> as a First Public 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>
+        
+      
+    
+  
+</div><div class="section" id="toc"><h2 class="introductory">Table of Contents</h2><ul class="toc"><li class="tocline"><a class="tocxref" href="#introduction"><span class="secno">1. </span>Introduction</a></li><li class="tocline"><a class="tocxref" href="#conformance"><span class="secno">2. </span>Conformance</a></li><li class="tocline"><a class="tocxref" href="#security-and-privacy-considerations"><span class="secno">3. </span>Security and Privacy Considerations</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#privacy-considerations-for-implementers-of-the-pick-media-intent"><span class="secno">3.1 </span>Privacy considerations for implementers of the Pick Media Intent</a></li><li class="tocline"><a class="tocxref" href="#privacy-considerations-for-recipients-of-media-objects"><span class="secno">3.2 </span>Privacy considerations for recipients of media objects</a></li><li class="tocline"><a class="tocxref" href="#additional-implementation-considerations"><span class="secno">3.3 </span>Additional implementation considerations</a></li></ul></li><li class="tocline"><a class="tocxref" href="#intent-description"><span class="secno">4. </span>Intent Description</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#intent-extras"><span class="secno">4.1 </span>Intent Extras</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#the-mediaintentextras-dictionary"><span class="secno">4.1.1 </span>The <span class="formerLink"><code>MediaIntentExtras</code></span> dictionary</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#dictionary-mediaintentextras-members"><span class="secno">4.1.1.1 </span>Dictionary <span class="formerLink"><code>MediaIntentExtras</code></span> Members</a></li></ul></li></ul></li></ul></li><li class="tocline"><a class="tocxref" href="#data-format"><span class="secno">5. </span>Data Format</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#the-media-dictionary"><span class="secno">5.1 </span>The <span class="formerLink"><code>Media</code></span> dictionary</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#dictionary-media-members"><span class="secno">5.1.1 </span>Dictionary <span class="formerLink"><code>Media</code></span> Members</a></li></ul></li><li class="tocline"><a class="tocxref" href="#the-mediacontent-dictionary"><span class="secno">5.2 </span>The <span class="formerLink"><code>MediaContent</code></span> dictionary</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#dictionary-mediacontent-members"><span class="secno">5.2.1 </span>Dictionary <span class="formerLink"><code>MediaContent</code></span> Members</a></li></ul></li><li class="tocline"><a class="tocxref" href="#the-mediaerror-dictionary"><span class="secno">5.3 </span>The <span class="formerLink"><code>MediaError</code></span> dictionary</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#dictionary-mediaerror-members"><span class="secno">5.3.1 </span>Dictionary <span class="formerLink"><code>MediaError</code></span> Members</a></li></ul></li><li class="tocline"><a class="tocxref" href="#extended-media-properties-and-parameters"><span class="secno">5.4 </span>Extended Media Properties and Parameters</a></li></ul></li><li class="tocline"><a class="tocxref" href="#media-service-example"><span class="secno">A. </span>Media Service Example</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#accessing-mediaintentextras-values---example-1"><span class="secno">A.1 </span>Accessing <span class="formerLink"><code>MediaIntentExtras</code></span> Values  - Example #1</a></li><li class="tocline"><a class="tocxref" href="#creating-media-object---example-2"><span class="secno">A.2 </span>Creating Media Object - Example #2</a></li></ul></li><li class="tocline"><a class="tocxref" href="#references"><span class="secno">B. </span>References</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#normative-references"><span class="secno">B.1 </span>Normative references</a></li><li class="tocline"><a class="tocxref" href="#informative-references"><span class="secno">B.2 </span>Informative references</a></li></ul></li></ul></div>
+
+    
+
+    <div id="introduction" class="informative section">
+      <!--OddPage--><h2><span class="secno">1. </span>Introduction</h2><p><em>This section is non-normative.</em></p>
+      <p>
+        On account of a number of media applications and services accessed from various devices, users tend to maintain their media data in multiple sources including local storage of devices and web-based media galleries. For instance, users upload subset of their photos to several different social media galleries with different metadata. For another example, users collect their favourite audio and video resources in several different media galleries which provide inconsistent metadata attributes one another.
+      </p>
+      <div class="note"><div class="note-title"><span>Note</span></div><p class="">
+              A terminology, <b>media object</b>, is used hereunder to denote <b>media data</b> that contain a media content and its related metadata. (See <a class="idlType" href="#idl-def-Media"><code>Media</code></a> dictionary)
+      </p></div>
+      <p>
+        This specification enables a Web application to have access to a selected subset of user's media objects, obtained from arbitrary services not known to the Web application. The interactions, brokered using Web Intents [<cite><a href="#bib-WEBINTENTS" class="bibref">WEBINTENTS</a></cite>] are designed in order to maximise the user's security and privacy. Media objects may be sourced from a plurality of sources — both online and local to the user's device — so long as those sources are registered as Intent services with the user agent. It defines a common media object format which services use to provide data to Web applications in a consistent and interoperable manner.
+      </p>
+      <p>
+        For a Pick Media Intent request, user permission can be naturally asked by a necessary user authentication process that a service implementer <em title="may" class="rfc2119">may</em> provide. Also, users can determine the result media objects to bring to the client with the searching and selecting functionalities that a service implementer <em title="may" class="rfc2119">may</em> provide.
+      </p>
+      <p>
+        A set of <a href="#security-and-privacy-considerations">Security and Privacy Considerations</a> are
+        presented for the discretion of both implementers of Pick Media Intent services and recipients of media
+        data (i.e. Web applications).
+      </p>
+      <p>
+        The following code illustrates how to obtain media object from a user's media gallery:
+      </p>
+      <div class="example"><div class="example-title"><span>Example 1</span></div><pre class="example highlight prettyprint"><span class="kwd">var</span><span class="pln"> intent </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Intent</span><span class="pun">({</span><span class="pln"> action</span><span class="pun">:</span><span class="pln">   </span><span class="str">"http://webintents.org/pick"</span><span class="pun">,</span><span class="pln">
+                          type</span><span class="pun">:</span><span class="pln">     </span><span class="str">"http://w3.org/type/media"</span><span class="pun">,</span><span class="pln">
+                          extras</span><span class="pun">:</span><span class="pln">   </span><span class="pun">{</span><span class="pln"> search</span><span class="pun">:</span><span class="pln"> </span><span class="str">"olympic"</span><span class="pun">,</span><span class="pln">
+                                      filters</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="str">"title"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"description"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"author"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"tags"</span><span class="pun">],</span><span class="pln">
+                                      limit</span><span class="pun">:</span><span class="pln"> </span><span class="lit">100</span><span class="pln"> </span><span class="pun">}});</span><span class="pln">
+navigator</span><span class="pun">.</span><span class="pln">startActivity</span><span class="pun">(</span><span class="pln">intent</span><span class="pun">,</span><span class="pln"> mediaOK</span><span class="pun">,</span><span class="pln"> mediaFail</span><span class="pun">);</span><span class="pln">
+
+</span><span class="kwd">function</span><span class="pln"> mediaOK </span><span class="pun">(</span><span class="pln">mediaObjectArray</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+    </span><span class="com">// iterate over the array of media objects to do something useful with them</span><span class="pln">
+</span><span class="pun">}</span><span class="pln">
+</span><span class="kwd">function</span><span class="pln"> mediaFail </span><span class="pun">(</span><span class="pln">err</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+    </span><span class="com">// display an error to the user</span><span class="pln">
+</span><span class="pun">}</span></pre></div>
+      <p>
+        When the above code is run, the user would typically be prompted by her user agent to select
+        a service able to pick media objects (there may be several such services, if she has multiple media galleries). Upon selecting a service, she will be presented with an interface enabling her
+        to choose what media objects are returned to the Web application. Upon completing her
+        choice, an array of the media objects would be returned to the Web application in the <code>mediaOK</code>
+        callback.
+      </p>
+    </div>
+
+    <div class="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 title="must" class="rfc2119">must</em>, <em title="must not" class="rfc2119">must not</em>, <em title="required" class="rfc2119">required</em>, <em title="should" class="rfc2119">should</em>, <em title="should not" class="rfc2119">should not</em>, <em title="recommended" class="rfc2119">recommended</em>, <em title="may" class="rfc2119">may</em>,
+  and <em title="optional" class="rfc2119">optional</em> in this specification are to be interpreted as described in [<cite><a href="#bib-RFC2119" class="bibref">RFC2119</a></cite>].
+</p>
+
+      <p>
+        There is only one single conformance requirement placed upon the <dfn id="dfn-user-agent">user agent</dfn>
+        product: a <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> support Web Intents [<cite><a href="#bib-WEBINTENTS" class="bibref">WEBINTENTS</a></cite>].
+      </p>
+      <p>
+        The conformance criteria in this specification apply to a single product: the
+        <dfn id="dfn-media-service">Media service</dfn> which exposes a Web Intent service that
+        handles Pick Media Intents as defined in this specification.
+      </p>
+      <p>
+        The data returned by the <a class="internalDFN" href="#dfn-media-service">Media service</a> is described in this specification using [<cite><a href="#bib-WEBIDL" class="bibref">WEBIDL</a></cite>].
+        When this data is provided using JavaScript, then the <a class="internalDFN" href="#dfn-media-service">Media service</a> <em title="must" class="rfc2119">must</em> do so in a manner
+        consistent with the ECMAScript Bindings defined in the Web IDL specification.
+      </p>
+    </div>
+
+    <div id="security-and-privacy-considerations" class="informative section">
+      <!--OddPage--><h2><span class="secno">3. </span>Security and Privacy Considerations</h2><p><em>This section is non-normative.</em></p>
+      <p>
+        The Intent defined in this specification can be used to find media objects from user's media galleries. The media objects, in the form of photos, videos, voice recordings with related metadata, may contain user's private information. The distribution of this information could
+        potentially compromise the user's privacy. A conforming implementation
+        of this specification should provide a mechanism that protects the user's privacy and this mechanism should ensure that no such information is retrievable without the user's express permission.
+      </p>
+      <div class="section" id="privacy-considerations-for-implementers-of-the-pick-media-intent">
+        <h3><span class="secno">3.1 </span>Privacy considerations for implementers of the Pick Media Intent</h3><p><em>This section is non-normative.</em></p>
+        <p>
+          A <a>media service</a> should not provide media objects to Web sites without the express
+          permission of the user. Obtaining the user's express permission to access a set of media objects does 
+          not imply that the user has granted permission for the same Web site to access more media objects.
+          A <a>media service</a> should take great care to ensure that the user can clearly see which information
+          is about to be shared, and must not share more information than has been requested by the Web application.
+        </p>
+        <p>
+          A <a class="internalDFN" href="#dfn-user-agent">user agent</a> may have prearranged trust relationships with a specific <a>media service</a> 
+          that do not require such user interaction.
+        </p>
+      </div>
+      <div class="section" id="privacy-considerations-for-recipients-of-media-objects">
+        <h3><span class="secno">3.2 </span>Privacy considerations for recipients of media objects</h3>
+        <p>
+          Web sites operators that retrieve media objects using this Intent are denoted as recipients
+          below.
+        </p>
+        <p>
+          Recipients should only request media objects when necessary, and only use the media objects for the task for which it was provided to them.
+        </p>
+        <p>
+          Recipients should dispose of media objects once that task is completed, unless expressly
+          permitted to retain it by the user. Recipients should also take measures to protect this information
+          against unauthorised access. If media objects are stored, users should be allowed to update and
+          delete this information.
+        </p>
+        <p>
+          The recipient of media objects should not retransmit the media objects without the
+          user's express permission. Care should be taken when retransmitting and use of encryption is
+          encouraged.
+        </p>
+        <p>
+          Recipients should clearly and conspicuously disclose the fact that they are collecting media objects,
+          the purpose of the collection, how long the data is retained, how the data is secured, how the data is
+          shared if it is shared, how users can access, update and delete the data, and any other choices that
+          users have with respect to the data. This disclosure should include an explanation of any exceptions to
+          the guidelines listed above.
+        </p>
+        <p>
+          Note that even if a user gives permission to share their media objects this can have serious
+          privacy implications for those parties whose media objects are shared, as they may not wish such sharing to
+          occur. This should be considered by Web applications when requesting and using such information.
+        </p>
+      </div>
+      <div class="section" id="additional-implementation-considerations">
+        <h3><span class="secno">3.3 </span>Additional implementation considerations</h3>
+        <p>
+          Further to the requirements listed in the previous section, implementers of a <a>user agents</a> are
+          also advised to consider the following aspects that can negatively affect the privacy of their users:
+          in certain cases, users can inadvertently grant permission to disclose their media objects
+          to Web sites. In other cases, the content hosted at a certain URL changes in such a way that the
+          previously granted permissions no longer apply as far as the user is concerned. Or the users
+          might simply change their minds.
+        </p>
+        <p>
+          Predicting or preventing these situations is inherently difficult. Mitigation and in-depth defensive
+          measures are a <a class="internalDFN" href="#dfn-user-agent">user agent</a>'s responsibility and not prescribed by this specification. However, in
+          designing these measures, implementers are advised to enable user awareness of information sharing, and to
+          provide easy access to user interfaces that enable revocation of permissions that Web applications have to
+          access this Intent.
+        </p>
+      </div>
+    </div>
+
+    <div class="section" id="intent-description">
+      <!--OddPage--><h2><span class="secno">4. </span>Intent Description</h2>
+      <p>
+        The action for this Intent is <code>http://webintents.org/pick</code>.
+      </p>
+      <p>
+        The type for this Intent is <code>http://w3.org/type/media</code>.
+      </p>
+      <p>
+        When a <a>media service</a> is matched for delivery using these action and type, it
+        <em title="must" class="rfc2119">must</em> respond in one of two ways:
+      </p>
+      <ul>
+        <li>
+          If media objects have been successfully selected for delivery, then a successful payload is returned
+          to the client (using <code>postResult()</code>) matching the data format defined below.
+        </li>
+        <li>
+          If an error of any kind takes place in the service, then an error pa