[BACK] Return to Overview.src.html CVS log [TXT] [DIR] Up to [Public] / 2006 / webapi / XMLHttpRequest

Annotation of 2006/webapi/XMLHttpRequest/Overview.src.html, revision 1.268

1.248 avankest 1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
1.1 avankest 2: <html lang="en-US">
 3: <head>
1.207 avankest 4:  <title>XMLHttpRequest</title>
1.16 avankest 5:  <style type="text/css">
1.117 avankest 6:  pre.idl { border:solid thin; background:#eee; color:#000; padding:0.5em }
1.16 avankest 7:  pre.idl :link, pre.idl :visited { color:inherit; background:transparent }
1.58 avankest 8:  pre code { color:inherit; background:transparent }
1.16 avankest 9:  div.example { margin-left:1em; padding-left:1em; border-left:double; color:#222; background:#fcfcfc }
1.89 avankest 10:  .note { margin-left:2em; font-weight:bold; font-style:italic; color:#008000 }
1.16 avankest 11:  p.note::before { content:"Note: " }
1.203 avankest 12:  .XXX { padding:.5em; border:solid #f00 }
 13:  p.XXX::before { content:"Issue: " }
1.119 avankest 14:  dl.switch { padding-left:2em }
1.248 avankest 15:  dl.switch > dt { text-indent:-1.5em }
 16:  dl.switch > dt:before { content:'21円AA'; padding:0 0.5em 0 0; display:inline-block; width:1em; text-align:right; line-height:0.5em }
1.16 avankest 17:  em.ct { text-transform:lowercase; font-variant:small-caps; font-style:normal }
 18:  dfn { font-weight:bold; font-style:normal }
 19:  code { color:orangered }
 20:  code :link, code :visited { color:inherit }
1.203 avankest 21:  hr:not(.top) { display:block; background:none; border:none; padding:0; margin:2em 0; height:auto }
 22:  table { border-collapse:collapse; border-style:hidden hidden none hidden }
 23:  table thead { border-bottom:solid }
 24:  table tbody th:first-child { border-left:solid }
 25:  table td, table th { border-left:solid; border-right:solid; border-bottom:solid thin; vertical-align:top; padding:0.2em }
1.16 avankest 26:  </style>
1.147 avankest 27:  <link rel="stylesheet" href="http://www.w3.org/StyleSheets/TR/W3C-[STATUS]">
1.1 avankest 28: </head>
 29: <body>
 30:  <div class="head">
 31:  <p><a href="http://www.w3.org/"><img height="48" width="72" alt="W3C" src="http://www.w3.org/Icons/w3c_home"></a></p>
1.12 avankest 32: 
1.229 avankest 33:  <h1 class="head" id="the-xmlhttprequest-object">XMLHttpRequest</h1>
1.248 avankest 34:  
1.12 avankest 35: 
1.149 avankest 36:  <h2 class="no-num no-toc" id="w3c-doctype">[LONGSTATUS] [DATE: 3 August 2002]</h2>
1.12 avankest 37: 
1.1 avankest 38:  <dl>
1.10 avankest 39:   <dt>This Version:</dt>
1.246 avankest 40:   <dd><a href="[VERSION]/">http://www.w3.org/TR/[YEAR]/ED-XMLHttpRequest-[CDATE]/</a></dd>
1.14 avankest 41: 
1.10 avankest 42:   <dt>Latest Version:</dt>
1.1 avankest 43:   <dd><a href="http://www.w3.org/TR/XMLHttpRequest/">http://www.w3.org/TR/XMLHttpRequest/</a></dd>
1.203 avankest 44: 
1.189 avankest 45:   <dt>Latest Editor Version:</dt>
 46:   <dd><a href="http://dev.w3.org/2006/webapi/XMLHttpRequest/">http://dev.w3.org/2006/webapi/XMLHttpRequest/</a></dd>
1.14 avankest 47: 
1.10 avankest 48:   <dt>Previous Versions:</dt>
1.248 avankest 49:   
1.231 avankest 50:   <dd><a href="http://www.w3.org/TR/2009/WD-XMLHttpRequest-20090820/">http://www.w3.org/TR/2009/WD-XMLHttpRequest-20090820/</a></dd>
1.173 avankest 51:   <dd><a href="http://www.w3.org/TR/2008/WD-XMLHttpRequest-20080415/">http://www.w3.org/TR/2008/WD-XMLHttpRequest-20080415/</a></dd>
1.154 avankest 52:   <dd><a href="http://www.w3.org/TR/2007/WD-XMLHttpRequest-20071026/">http://www.w3.org/TR/2007/WD-XMLHttpRequest-20071026/</a></dd>
1.133 avankest 53:   <dd><a href="http://www.w3.org/TR/2007/WD-XMLHttpRequest-20070618/">http://www.w3.org/TR/2007/WD-XMLHttpRequest-20070618/</a></dd>
1.58 avankest 54:   <dd><a href="http://www.w3.org/TR/2007/WD-XMLHttpRequest-20070227/">http://www.w3.org/TR/2007/WD-XMLHttpRequest-20070227/</a></dd>
1.22 avankest 55:   <dd><a href="http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060927/">http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060927/</a></dd>
1.1 avankest 56:   <dd><a href="http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060619/">http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060619/</a></dd>
 57:   <dd><a href="http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060405/">http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060405/</a></dd>
1.248 avankest 58:   
 59:   
1.14 avankest 60: 
1.1 avankest 61:   <dt>Editor:</dt>
 62:   <dd><a href="http://annevankesteren.nl/">Anne van Kesteren</a>
 63:   (<a href="http://www.opera.com/">Opera Software ASA</a>)
 64:   &lt;<a href="mailto:annevk@opera.com">annevk@opera.com</a>&gt;</dd>
 65:  </dl>
1.14 avankest 66: 
1.1 avankest 67:  <p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>
1.229 avankest 68:  &copy; 2009
1.51 avankest 69:  <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>&reg;</sup>
 70:  (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
 71:  <a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
 72:  <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C
 73:  <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
 74:  <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
 75:  and
 76:  <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document
 77:  use</a> rules apply.</p>
1.1 avankest 78:  </div>
1.12 avankest 79: 
1.1 avankest 80:  <hr>
1.12 avankest 81: 
1.1 avankest 82:  <h2 class="no-num no-toc" id="specabstract">Abstract</h2>
1.10 avankest 83: 
1.248 avankest 84:  
 85:  
1.229 avankest 86:  <p>The XMLHttpRequest specification defines an API
1.207 avankest 87:  that provides scripted client functionality for transferring data between
 88:  a client and a server.</p>
1.248 avankest 89:  
1.12 avankest 90: 
1.1 avankest 91:  <h2 class="no-num no-toc" id="sotd">Status of this Document</h2>
1.12 avankest 92: 
1.1 avankest 93:  <p><em>This section describes the status of this document at the time of its
1.36 avankest 94:  publication. Other documents may supersede this document. A list of current
 95:  W3C publications and the latest revision of this technical report can be
 96:  found in the <a href="http://www.w3.org/TR/">W3C technical reports index</a>
1.117 avankest 97:  at http://www.w3.org/TR/.</em></p>
1.36 avankest 98: 
1.248 avankest 99:  <p>This is the [DATE: 3 August 2002] <!--Last Call Working Draft-->[LONGSTATUS] of
 100:  XMLHttpRequest. Please send comments to
 101:  <a href="mailto:public-webapps@w3.org?subject=[XHR]%20">public-webapps@w3.org</a>
1.207 avankest 102:  (<a href="http://lists.w3.org/Archives/Public/public-webapps/">archived</a>)
1.248 avankest 103:  with <samp>[XHR]</samp> at the start of the subject line.</p>
1.51 avankest 104: 
1.47 avankest 105:  <p>This document is produced by the
1.248 avankest 106:  <a href="http://www.w3.org/2008/webapps/">Web Applications</a> (WebApps) Working Group.
 107:  The WebApps Working Group is part of the
1.207 avankest 108:  <a href="http://www.w3.org/2006/rwc/Activity">Rich Web Clients Activity</a>
1.248 avankest 109:  in the W3C <a href="http://www.w3.org/Interaction/">Interaction Domain</a>.</p>
1.12 avankest 110: 
1.1 avankest 111:  <p>This document was produced by a group operating under the
1.248 avankest 112:  <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004
 113:  W3C Patent Policy</a>. W3C maintains a
1.207 avankest 114:  <a rel="disclosure" href="http://www.w3.org/2004/01/pp-impl/42538/status">public
1.248 avankest 115:  list of any patent disclosures</a> made in connection with the deliverables of
 116:  the group; that page also includes instructions for disclosing a patent. An
 117:  individual who has actual knowledge of a patent which the individual believes
 118:  contains
1.36 avankest 119:  <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential
 120:  Claim(s)</a> must disclose the information in accordance with
 121:  <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
 122:  6 of the W3C Patent Policy</a>.</p>
1.12 avankest 123: 
1.248 avankest 124:  <p>Publication as a Working Draft does not imply endorsement by the W3C
 125:  Membership. This is a draft document and may be updated, replaced or
 126:  obsoleted by other documents at any time. It is inappropriate to cite this
 127:  document as other than work in progress.</p>
1.268 ! avankest 128:  
 ! 129: 
 ! 130:  <h3 class="no-num no-toc" id="crec">Candidate Recommendation Exit Criteria</h3>
 ! 131: 
 ! 132:  <p>To exit the Candidate Recommendation (CR) stage the following criteria
 ! 133:  <em class="ct">must</em> have been met:</p>
 ! 134: 
 ! 135:  <ol>
 ! 136:  <li>There will be at least two interoperable implementations passing all
 ! 137:  test cases in the test suite for this specification. An implementation is
 ! 138:  to be available (i.e. for download), shipping (i.e. not private), and not
 ! 139:  experimental (i.e. intended for a wide audience). The working group will
 ! 140:  decide when the test suite is of sufficient quality to test
 ! 141:  interoperability.</li>
 ! 142: 
 ! 143:  <li>A minimum of six months of the CR stage will have elapsed. This is to
 ! 144:  ensure that enough time is given for any remaining major errors to be
 ! 145:  caught. The CR period will be extended if implementations are slow to
 ! 146:  appear.</li>
 ! 147:  </ol>
 ! 148: 
 ! 149:  <p>An update to this draft will point to the test suite.</p>
 ! 150: 
1.207 avankest 151: 
 152: 
1.1 avankest 153:  <h2 class="no-num no-toc" id="toc">Table of Contents</h2>
1.21 avankest 154: 
1.1 avankest 155:  <!--toc-->
1.12 avankest 156: 
1.207 avankest 157: 
 158: 
1.1 avankest 159:  <h2 id="introduction">Introduction</h2>
1.12 avankest 160: 
1.1 avankest 161:  <p><em>This section is non-normative.</em></p>
1.12 avankest 162: 
1.183 avankest 163:  <p>The <code>XMLHttpRequest</code> object implements an interface exposed
 164:  by a scripting engine that allows scripts to perform HTTP client
 165:  functionality, such as submitting form data or loading data from a
 166:  server. It is the ECMAScript HTTP API.</p>
1.24 avankest 167: 
1.1 avankest 168:  <p>The name of the object is <code>XMLHttpRequest</code> for compatibility
1.183 avankest 169:  with the Web, though each component of this name is potentially
 170:  misleading. First, the object supports any text based format, including
 171:  XML. Second, it can be used to make requests over both HTTP and HTTPS
 172:  (some implementations support protocols in addition to HTTP and HTTPS, but
 173:  that functionality is not covered by this specification). Finally, it
 174:  supports "requests" in a broad sense of the term as it pertains to HTTP;
 175:  namely all activity involved with HTTP requests or responses for the
 176:  defined HTTP methods.</p>
1.12 avankest 177: 
1.14 avankest 178:  <div class="example">
1.250 avankest 179:  <p>Some simple code to do something with data from an XML document
 180:  fetched over the network:</p>
1.16 avankest 181: 
1.58 avankest 182:  <pre><code>function test(data) {
1.14 avankest 183: // taking care of data
 184: }
 185: 
 186: function handler() {
1.117 avankest 187: if(this.readyState == 4 &amp;&amp; this.status == 200) {
1.14 avankest 188:  // so far so good
1.117 avankest 189:  if(this.responseXML != null &amp;&amp; this.responseXML.getElementById('test').firstChild.data)
 190:   // success!
1.14 avankest 191:  test(this.responseXML.getElementById('test').firstChild.data);
 192:  else
 193:  test(null);
1.117 avankest 194: } else if (this.readyState == 4 &amp;&amp; this.status != 200) {
1.14 avankest 195:  // fetched the wrong page or network error...
 196:  test(null);
 197: }
 198: }
1.12 avankest 199: 
1.14 avankest 200: var client = new XMLHttpRequest();
 201: client.onreadystatechange = handler;
1.250 avankest 202: client.open("GET", "unicorn.xml");
1.58 avankest 203: client.send();</code></pre>
1.16 avankest 204: 
1.56 avankest 205:  <p>If you just want to log a message to the server:</p>
1.16 avankest 206: 
1.58 avankest 207:  <pre><code>function log(message) {
1.14 avankest 208: var client = new XMLHttpRequest();
1.56 avankest 209: client.open("POST", "/log");
1.57 avankest 210: client.setRequestHeader("Content-Type", "text/plain;charset=UTF-8");
1.14 avankest 211: client.send(message);
1.58 avankest 212: }</code></pre>
1.16 avankest 213: 
1.14 avankest 214:  <p>Or if you want to check the status of a document on the server:</p>
1.16 avankest 215: 
1.58 avankest 216:  <pre><code>function fetchStatus(address) {
1.14 avankest 217: var client = new XMLHttpRequest();
 218: client.onreadystatechange = function() {
 219:  // in case of network errors this might not give reliable results
 220:  if(this.readyState == 4)
 221:  returnStatus(this.status);
 222: }
 223: client.open("HEAD", address);
 224: client.send();
1.58 avankest 225: }</code></pre>
1.14 avankest 226:  </div>
1.12 avankest 227: 
1.203 avankest 228: 
 229: 
1.248 avankest 230: 
 231:  <h2 id="conformance">Conformance Criteria</h2>
1.12 avankest 232: 
1.27 avankest 233:  <p>Everything in this specification is normative except for diagrams,
 234:  examples, notes and sections marked non-normative.</p>
1.12 avankest 235: 
1.1 avankest 236:  <p>The key words <em class="ct">must</em>, <em class="ct">must not</em>,
1.259 avankest 237:  <em class="ct">should</em>, <em class="ct">should not</em>, and
 238:  <em class="ct">may</em> in this document are to be interpreted as
 239:  described in RFC 2119. [<cite><span>RFC2119</span></cite>]</p>
1.12 avankest 240: 
1.1 avankest 241:  <p>This specification defines the following classes of products:</p>
1.12 avankest 242: 
1.1 avankest 243:  <dl>
1.74 avankest 244:  <dt><dfn id="conforming-user-agent">Conforming user agent</dfn></dt>
1.24 avankest 245: 
1.74 avankest 246:  <dd>
 247:   <p>A user agent <em class="ct">must</em> behave as described in this
1.106 avankest 248:   specification in order to be considered conformant.</p>
1.95 avankest 249: 
1.248 avankest 250:   
1.224 avankest 251:   <p>If the user agent is not a <span>conforming XML user agent</span> the
 252:   <span>XML response entity body</span> <em class="ct">must</em> (always)
1.239 avankest 253:   be null.</p>
1.248 avankest 254:   
1.140 avankest 255: 
 256:   <p>User agents <em class="ct">may</em> implement algorithms given in
 257:   this specification in any way desired, so long as the end result is
 258:   indistinguishable from the result that would be obtained by the
 259:   specification's algorithms.</p>
1.110 avankest 260: 
1.95 avankest 261:   <p class="note">This specification uses both the terms "conforming user
 262:   agent(s)" and "user agent(s)" to refer to this product class.</p>
1.74 avankest 263:  </dd>
1.248 avankest 264:  
1.94 avankest 265:  <dt><dfn id="conforming-xml-user-agent">Conforming XML user agent</dfn></dt>
1.110 avankest 266: 
1.224 avankest 267:  <dd><p>An XML user agent <em class="ct">must</em> be a
 268:  <span>conforming user agent</span> and <em class="ct">must</em> be a
 269:  conforming XML processor that reports violations of
 270:  namespace well-formedness. [<cite><span>XML</span></cite>]</p></dd>
1.248 avankest 271:  
1.1 avankest 272:  </dl>
1.32 avankest 273: 
1.153 avankest 274:  <h3 id="dependencies">Dependencies</h3>
1.33 avankest 275: 
1.29 avankest 276:  <p>This specification relies on several underlying specifications.</p>
1.248 avankest 277: 
1.29 avankest 278:  <dl>
1.248 avankest 279:  
 280: 
1.29 avankest 281:  <dt>DOM</dt>
1.33 avankest 282: 
1.155 avankest 283:  <dd><p>A <span title="conforming user agent">conforming user agent</span>
1.176 avankest 284:  <em class="ct">must</em> support at least the subset of the functionality
1.182 avankest 285:  defined in DOM Events and DOM Core that this specification relies upon,
 286:  such as various exceptions and <code>EventTarget</code>.
1.155 avankest 287:  [<cite><span>DOM2Events</span></cite>]
 288:  [<cite><span>DOM3Core</span></cite>]</p></dd>
1.29 avankest 289: 
1.250 avankest 290:  <dt>HTML5</dt>
1.161 avankest 291: 
 292:  <dd>
1.189 avankest 293:   <p>A <span>conforming user agent</span> <em class="ct">must</em> support
1.250 avankest 294:   at least the subset of the functionality defined in HTML5 that
1.197 avankest 295:   this specification relies upon, such as the basics of the
 296:   <code>Window</code> object and serializing a <code>Document</code>
 297:   object. [<cite><span>HTML5</span></cite>]</p>
1.161 avankest 298: 
 299:   <p class="note">The
 300:   <a href="http://www.w3.org/TR/2006/WD-Window-20060407/">Window Object
 301:   1.0</a> draft is not referenced normatively as it appears to be no
1.250 avankest 302:   longer maintained and HTML5 defines the <code>Window</code> object in
 303:   more detail. This specification already depends on HTML5 for other
 304:   reasons so there is not much additional overhead because of this.</p>
1.161 avankest 305: 
1.29 avankest 306:  <dt>HTTP</dt>
1.33 avankest 307: 
1.248 avankest 308:  <dd><p>A <span title="conforming user agent">conforming user agent</span>
 309:  <em class="ct">must</em> support some version of the HTTP protocol.
 310:  Requirements regarding HTTP are made throughout the specification.
 311:  [<cite><span>RFC2616</span></cite>]</p></dd>
1.189 avankest 312: 
1.181 avankest 313:  <dt>Web IDL</dt>
1.203 avankest 314: 
1.248 avankest 315:  <dd><p>A <span>conforming user agent</span> <em class="ct">must</em> also
 316:  be a conforming implementation of the IDL fragments in this
 317:  specification, as described in the Web IDL specification.
1.181 avankest 318:  [<cite><span>WebIDL</span></cite>]
1.248 avankest 319: 
 320:  
1.29 avankest 321:  </dl>
1.12 avankest 322: 
1.157 avankest 323: 
1.153 avankest 324:  <h3 id="terminology">Terminology</h3>
1.209 avankest 325: 
1.233 avankest 326:  <p><dfn id="dfn-obtain-unicode">convert a DOMString to a sequence of Unicode characters</dfn>
 327:  is defined by the Web IDL specification.
 328:  [<cite><span>WebIDL</span></cite>]</p>
1.266 avankest 329: 
 330:  <p>The term <dfn>user credentials</dfn> for the purposes of this
 331:  specification means cookies, HTTP authentication, and client-side SSL
 332:  certificates. Specifically it does not refer to proxy authentication or
 333:  the <code title="http-origin">Origin</code> header.
 334:  <a href="#ref-cookies">[COOKIES]</a> <!-- XXX ref? --></p>
1.248 avankest 335:  
1.200 avankest 336:  <p>The terms and algorithms
1.257 avankest 337:  <dfn id="url-fragment"><code>&lt;fragment></code></dfn>,
 338:  <dfn id="url-scheme"><code>&lt;scheme></code></dfn>,
1.265 avankest 339:  <dfn id="cookie-free-document-object">cookie-free <code>Document</code> object</dfn>,
1.203 avankest 340:  <dfn id="document-base-url">document base URL</dfn>,
1.244 avankest 341:  <dfn id="document-character-encoding">document's character encoding</dfn>,
1.205 avankest 342:  <dfn id="event-handler-attributes-0">event handler attributes</dfn>,
1.203 avankest 343:  <dfn id="event-handler-event-type">event handler event type</dfn>,
1.260 avankest 344:  <dfn id="fetch">fetch</dfn>,
1.203 avankest 345:  <dfn id="fully-active">fully active</dfn>,
1.206 avankest 346:  <dfn id="function"><code>Function</code></dfn>,
1.225 avankest 347:  <dfn id="dom-innerhtml" title="dom-innerHTML"><code>innerHTML</code></dfn>,
1.200 avankest 348:  <dfn id="origin">origin</dfn>,
1.232 avankest 349:  <dfn id="preferred-mime-name">preferred MIME name</dfn>,
1.203 avankest 350:  <dfn id="resolve-a-url">resolve a URL</dfn>,
 351:  <dfn id="same-origin">same origin</dfn>,
 352:  <dfn id="storage-mutex">storage mutex</dfn>,
 353:  <dfn id="task">task</dfn>,
 354:  <dfn id="task-source">task source</dfn>,
1.252 avankest 355:  <dfn id="task-queues">task queues</dfn>,
1.203 avankest 356:  <dfn id="url">URL</dfn>,
1.232 avankest 357:  <dfn id="url-character-encoding">URL character encoding</dfn>,
 358:  <dfn id="queue-a-task">queue a task</dfn>, and
 359:  <dfn id="valid-mime-type">valid MIME type</dfn>
1.250 avankest 360:  are defined by the HTML5 specification.
1.157 avankest 361:  [<cite><span>HTML5</span></cite>]</p>
1.210 avankest 362: 
1.203 avankest 363:  <p>The term <dfn id="entity-body">entity body</dfn> is used as described
 364:  in RFC 2616. <dfn id="method-token">Method token</dfn> is used as
 365:  described in section 5.1.1 of RFC 2616. <dfn><code>field-name</code></dfn>
 366:  and <dfn><code>field-value</code></dfn> are used as described in section
 367:  4.2 of RFC 2616. [<cite><span>RFC2616</span></cite>]</p>
1.218 avankest 368: 
1.258 avankest 369:  <p>To <dfn>deflate a DOMString into a byte sequence</dfn> means to create
 370:  a sequence of bytes such that the <var title="">n</var>th byte of the
 371:  sequence is equal to the low-order byte of the <var title="">n</var>th
 372:  code point in the original DOMString.</p>
 373: 
 374:  <p>To <dfn>inflate a byte sequence into a DOMString</dfn> means to create
 375:  a DOMString such that the <var title="">n</var>th code point has 0x00 as
 376:  the high-order byte and the <var title="">n</var>th byte of the byte
 377:  sequence as the low-order byte.</p>
1.256 avankest 378: 
1.203 avankest 379:  <p><dfn><code>userinfo</code></dfn> is used as described in section 3.2.1
 380:  of RFC 3986. [<cite><span>RFC3986</span></cite>]</p>
 381: 
 382:  <p>To <dfn id="dispatch-readystatechange-event">dispatch a
 383:  <code>readystatechange</code> event</dfn> means that an event with the
1.232 avankest 384:  name <code>readystatechange</code>, which does not bubble and is not
 385:  cancelable, and which uses the <code>Event</code> interface, is to be
 386:  dispatched at the <code>XMLHttpRequest</code> object.</p>
1.80 avankest 387: 
1.248 avankest 388:  
 389: 
1.153 avankest 390:  <h3 id="extensibility">Extensibility</h3>
1.12 avankest 391: 
1.250 avankest 392:  <p>User agents, Working Groups, and other interested parties are
 393:  <em>strongly encouraged</em> to discuss extensions on a relevant public
 394:  forum, preferably
 395:  <a href="mailto:public-webapps@w3.org">public-webapps@w3.org</a>. If this
 396:  is for some reason not possible prefix the extension in some way and start
 397:  the prefix with an uppercase letter. E.g. if company Foo wants to add a
 398:  private method <code>bar()</code> it could be named <code>FooBar()</code>
 399:  to prevent clashes with a potential future standardized
 400:  <code>bar()</code>.</p>
1.12 avankest 401: 
1.153 avankest 402: 
1.223 avankest 403:  <h2>The <code title="">XMLHttpRequest</code> Interface</h2>
1.12 avankest 404: 
1.58 avankest 405:  <p>The <code>XMLHttpRequest</code> object can be used by scripts to
1.22 avankest 406:  programmatically connect to their originating server via HTTP.</p>
1.12 avankest 407: 
1.228 avankest 408:  <pre class="idl">[NoInterfaceObject]
 409: interface <dfn id="xmlhttprequesteventtarget">XMLHttpRequestEventTarget</dfn> : EventTarget {
 410:  // for future use
 411: };
 412: 
1.240 avankest 413: [<span title="dom-XMLHttpRequest">Constructor</span>]
1.228 avankest 414: interface <dfn id="xmlhttprequest">XMLHttpRequest</dfn> : <span>XMLHttpRequestEventTarget</span> {
1.206 avankest 415:  // <a href="#event-handler-attributes">event handler attributes</a>
 416:      attribute <span>Function</span> <span>onreadystatechange</span>;
1.58 avankest 417: 
1.205 avankest 418:  // <a href="#states">states</a>
1.71 avankest 419:  const unsigned short <span title="UNSENT state">UNSENT</span> = 0;
1.134 avankest 420:  const unsigned short <span title="OPENED state">OPENED</span> = 1;
1.123 avankest 421:  const unsigned short <span title="HEADERS_RECEIVED state">HEADERS_RECEIVED</span> = 2;
1.86 avankest 422:  const unsigned short <span title="LOADING state">LOADING</span> = 3;
1.117 avankest 423:  const unsigned short <span title="DONE state">DONE</span> = 4;
1.70 avankest 424:  readonly attribute unsigned short <span>readyState</span>;
1.58 avankest 425: 
1.205 avankest 426:  // <a href="#request">request</a>
1.226 avankest 427:  void <span>open</span>(DOMString <var>method</var>, DOMString <var title="">url</var>);
 428:  void <span>open</span>(DOMString <var>method</var>, DOMString <var title="">url</var>, boolean <var>async</var>);
1.228 avankest 429:  void <span>open</span>(DOMString <var>method</var>, DOMString <var title="">url</var>, boolean <var>async</var>, DOMString? <var>user</var>);
 430:  void <span>open</span>(DOMString <var>method</var>, DOMString <var title="">url</var>, boolean <var>async</var>, DOMString? <var>user</var>, DOMString? <var>password</var>);
1.226 avankest 431:  void <span>setRequestHeader</span>(DOMString <var>header</var>, DOMString <var>value</var>);
1.70 avankest 432:  void <span>send</span>();
1.226 avankest 433:  void <span>send</span>(Document <var>data</var>);
1.228 avankest 434:  void <span>send</span>([AllowAny] DOMString? <var>data</var>);
1.70 avankest 435:  void <span>abort</span>();
1.58 avankest 436: 
1.205 avankest 437:  // <a href="#response">response</a>
1.203 avankest 438:  readonly attribute unsigned short <span>status</span>;
 439:  readonly attribute DOMString <span>statusText</span>;
1.226 avankest 440:  DOMString <span>getResponseHeader</span>(DOMString <var>header</var>);
1.70 avankest 441:  DOMString <span>getAllResponseHeaders</span>();
 442:  readonly attribute DOMString <span>responseText</span>;
 443:  readonly attribute Document <span>responseXML</span>;
1.228 avankest 444: };</pre>
1.8 avankest 445: 
1.235 avankest 446:  <!-- XXX domintro boxes; HTML5-style -->
 447: 
1.124 avankest 448: 
1.203 avankest 449:  <h3>Origin and Base URL</h3>
 450: 
 451:  <p>Each <code>XMLHttpRequest</code> object has an associated
 452:  <dfn id="xmlhttprequest-origin"><code>XMLHttpRequest</code> origin</dfn>
 453:  and an
 454:  <dfn id="xmlhttprequest-base-url"><code>XMLHttpRequest</code> base URL</dfn>.
 455: 
 456:  <p>This specification defines their values when the global object is
 457:  represented by the <code>Window</code> object. When the
1.246 avankest 458:  <code>XMLHttpRequest</code> object is used in other contexts their values
1.203 avankest 459:  will have to be defined as appropriate for that context. That is
 460:  considered to be out of scope for this specification.</p>
 461: 
 462:  <p>In environments where the global object is represented by the
 463:  <code>Window</code> object the <code>XMLHttpRequest</code> object has an
 464:  associated
 465:  <dfn id="xmlhttprequest-document"><code>XMLHttpRequest</code> <code>Document</code></dfn>
 466:  which is the <code>Document</code> object associated with the
 467:  <code>Window</code> object for which the <code>XMLHttpRequest</code>
 468:  interface object was created.</p>
 469: 
 470:  <p class="note">The
 471:  <span><code>XMLHttpRequest</code> <code>Document</code></span> is used to
 472:  determine the <span><code>XMLHttpRequest</code> origin</span> and
 473:  <span><code>XMLHttpRequest</code> base URL</span> at a later stage.</p>
 474: 
 475: 
1.263 avankest 476: 
1.203 avankest 477:  <h3>Task Sources</h3>
1.218 avankest 478: 
1.251 avankest 479:  <p>The <span>task source</span> used by this specification is the
 480:  <dfn><code>XMLHttpRequest</code> task source</dfn>.</p>
1.203 avankest 481: 
 482: 
1.211 avankest 483:  <h3 id="constructors">Constructors</h3>
1.203 avankest 484: 
1.263 avankest 485:  
 486: 
1.203 avankest 487:  <p>When the
1.266 avankest 488:  <dfn id="dom-xmlhttprequest" title="dom-XMLHttpRequest"><code>XMLHttpRequest()</code></dfn>
1.203 avankest 489:  constructor is invoked, the user agent <em class="ct">must</em> return a
 490:  new <code>XMLHttpRequest</code> object.</p>
 491: 
1.263 avankest 492:  
1.203 avankest 493: 
1.205 avankest 494:  <h3 id="event-handler-attributes">Event Handler Attributes</h3>
 495: 
1.248 avankest 496:  
 497: 
1.205 avankest 498:  <p>The following is the
 499:  <span title="event handler attributes">event handler attribute</span> (and
 500:  its corresponding <span>event handler event type</span>) that
 501:  <em class="ct">must</em> be supported as DOM attribute by the
 502:  <code>XMLHttpRequest</code> object:</p>
 503: 
 504:  <table>
 505:  <thead>
 506:   <tr>
 507:   <th><span title="event handler attributes">event handler attribute</span>
 508:   <th><span>event handler event type</span>
 509:  <tbody>
 510:   <tr>
 511:   <td><dfn id="onreadystatechange"><code>onreadystatechange</code></dfn>
 512:   <td><code>readystatechange</code></td>
 513:  </table>
 514: 
 515: 
 516:  <h3 id="states">States</h3>
1.203 avankest 517: 
 518:  <p>The <code>XMLHttpRequest</code> object can be in several states. The
 519:  <dfn id="readystate"><code>readyState</code></dfn> attribute, on getting,
 520:  <em class="ct">must</em> return the current state, which
 521:  <em class="ct">must</em> be one of the following values:</p>
 522: 
 523:  <dl>
 524:  <dt><dfn id="unsent-state" title="UNSENT state"><code>UNSENT</code></dfn>
 525:  (numeric value 0)</dt>
 526:  <dd><p>The object has been constructed.</p></dd>
 527: 
 528:  <dt><dfn id="opened-state" title="OPENED state"><code>OPENED</code></dfn>
 529:  (numeric value 1)</dt>
 530:  <dd><p>The <code>open()</code> method has been successfully invoked.
 531:  During this state request headers can be set using
 532:  <code>setRequestHeader()</code> and the request can be made using the
 533:  <code>send()</code> method.</p></dd>
 534: 
 535:  <dt><dfn id="headers-received-state" title="HEADERS_RECEIVED state"><code>HEADERS_RECEIVED</code></dfn>
 536:  (numeric value 2)</dt>
1.257 avankest 537:  <dd><p>All redirects (if any) have been followed and all HTTP headers of
 538:  the final response have been received. Several response members of the
 539:  object are now available.</p></dd>
1.203 avankest 540: 
 541:  <dt><dfn id="loading-state" title="LOADING state"><code>LOADING</code></dfn>
 542:  (numeric value 3)</dt>
 543:  <dd><p>The <span>response entity body</span> is being received.</p></dd>
 544: 
 545:  <dt><dfn id="done-state" title="DONE state"><code>DONE</code></dfn>
 546:  (numeric value 4)</dt>
 547:  <dd><p>The data transfer has been completed or something went wrong
 548:  during the transfer (e.g. infinite redirects).</p></dd>
 549:  </dl>
 550: 
 551:  <p>The <span title="OPENED state">OPENED</span> state has an associated
 552:  <dfn id="send-flag"><code>send()</code> flag</dfn> that indicates whether
 553:  the <code>send()</code> method has been invoked. It can be either true
 554:  or false and has an initial value of false.</p>
 555: 
 556:  <p>The <span title="DONE state">DONE</span> state has an associated
 557:  <dfn id="error-flag">error flag</dfn> that indicates some type of network
 558:  error or abortion. It can be either true or false and has an initial value
 559:  of false.</p>
 560: 
 561: 
1.205 avankest 562:  <h3 id="request">Request</h3>
1.203 avankest 563: 
 564:  <p>The <code>XMLHttpRequest</code> object holds the following request
 565:  metadata variables:</p>
 566: 
1.204 avankest 567:  <dl>
 568:  <dt>The <dfn>asynchronous flag</dfn></dt>
1.266 avankest 569:  <dd>True when <span title="fetch">fetching</span> is done asychronously.
 570:  False when fetching is done synchronously.</dd>
1.204 avankest 571: 
 572:  <dt>The <dfn>request method</dfn></dt>
 573:  <dd>The method used in the request.</dd>
 574: 
 575:  <dt>The <dfn>request URL</dfn></dt>
 576:  <dd>The <span>URL</span> used in the request.</dd>
1.218 avankest 577: 
1.204 avankest 578:  <dt>The <dfn>request username</dfn></dt>
 579:  <dd>The username used in the request or null if there is no
 580:  username.</dd>
1.218 avankest 581: 
1.204 avankest 582:  <dt>The <dfn>request password</dfn></dt>
 583:  <dd>The password used in the request or null if there is no
 584:  password.</dd>
1.218 avankest 585: 
1.204 avankest 586:  <dt>The <dfn id="author-request-headers">author request headers</dfn></dt>
 587:  <dd>A list consisting of HTTP header name/value pairs to be used in the
 588:  request.</p>
1.203 avankest 589: 
1.204 avankest 590:  <dt>The <dfn>request entity body</dfn></dt>
1.218 avankest 591:  <dd>The <span>entity body</span> used in the request.</dd>
1.248 avankest 592:  
 593:  
1.204 avankest 594:  </dl>
1.203 avankest 595: 
1.248 avankest 596:  
 597: 
1.203 avankest 598: 
 599:  <h4>The <code title="">open()</code> method</h4>
1.88 avankest 600: 
1.203 avankest 601:  <p>When the <dfn id="open" title="open"><code>open(<var>method</var>,
 602:  <var title="">url</var>, <var>async</var>, <var>user</var>,
 603:  <var>password</var>)</code></dfn> method is invoked, the user agent
1.217 avankest 604:  <em class="ct">must</em> run these steps (unless otherwise indicated):</p>
1.90 avankest 605: 
1.88 avankest 606:  <ol>
1.203 avankest 607:  <li>
 608:   <p>If the <code>XMLHttpRequest</code> object has an associated
 609:   <span><code>XMLHttpRequest</code> <code>Document</code></span> run
 610:   these substeps:</p>
1.90 avankest 611: 
1.203 avankest 612:   <ol>
 613:   <li><p>If the
 614:   <span><code>XMLHttpRequest</code> <code>Document</code></span> is not
 615:   <span>fully active</span> raise an <code>INVALID_STATE_ERR</code>
 616:   exception and terminate the overall set of steps.</p></li>
 617: 
 618:   <li><p>Let <span><code>XMLHttpRequest</code> base URL</span> be the
 619:   <span>document base URL</span> of the
 620:   <span><code>XMLHttpRequest</code> <code>Document</code></span>.</p></li>
 621: 
 622:   <li><p>Let <span><code>XMLHttpRequest</code> origin</span> be the
 623:   <span>origin</span> of the
 624:   <span><code>XMLHttpRequest</code> <code>Document</code></span>.</p></li>
 625:   </ol>
 626:  </li>
1.90 avankest 627: 
1.256 avankest 628:  <li><p>If any code point in <var>method</var> is higher than
 629:  U+00FF LATIN SMALL LETTER Y WITH DIAERESIS or after
 630:  <span title="deflate a DOMString into an byte sequence">deflating</span>
 631:  <var>method</var> it does not match the
1.210 avankest 632:  <span>Method token</span> production raise a <code>SYNTAX_ERR</code>
1.256 avankest 633:  exception and terminate these steps. Otherwise let <var>method</var> be
 634:  the result of
 635:  <span title="deflate a DOMString into an byte sequence">deflating</span>
 636:  <var>method</var>.</p></li> <!-- This sounds lame, but it works. -->
1.118 avankest 637: 
1.115 avankest 638:  <li>
1.256 avankest 639:   <p>If <var>method</var> is a case-insensitive match for
1.203 avankest 640:   <code>CONNECT</code>, <code>DELETE</code>, <code>GET</code>,
 641:   <code>HEAD</code>, <code>OPTIONS</code>, <code>POST</code>,
 642:   <code>PUT</code>, <code>TRACE</code>, or <code>TRACK</code>
1.256 avankest 643:   subtract 0x20 from each byte in the range 0x61 (ASCII a) to
 644:   0x7A (ASCII z).</p>
1.118 avankest 645: 
1.203 avankest 646:   <p class="note">If it does not match any of the above, it is passed
 647:   through <em>literally</em>, including in the final request.</p>
1.115 avankest 648:  </li>
1.203 avankest 649:  <!-- WebKit (and supposedly Gecko) also uppercase: COPY, INDEX, LOCK,
 650:  M-POST, MKCOL, MOVE, PROPFIND, PROPPATCH, and UNLOCK. -->
1.118 avankest 651: 
1.111 avankest 652:  <li>
1.256 avankest 653:   <p>If <var>method</var> is a case-sensitive match for
1.259 avankest 654:   <code>CONNECT</code>, <code>TRACE</code>, or <code>TRACK</code> raise a
 655:   <code>SECURITY_ERR</code> exception and terminate these steps.</p>
1.117 avankest 656: 
1.203 avankest 657:   <p class="note">Allowing these methods poses a security risk.
 658:   [<cite><span>HTTPVERBSEC</span></cite>]</p>
1.111 avankest 659:  </li>
 660: 
1.203 avankest 661:  <li><p>Let <var title="">url</var> be a <span>URL</span>.</p></li>
 662: 
1.209 avankest 663:  <li><p>Let <span>URL character encoding</span> of <var title="">url</var>
 664:  be UTF-8.</p></li>
1.113 avankest 665: 
1.255 avankest 666:  <li><p><span title="Resolve a URL">Resolve</span> <var title="">url</var>
1.203 avankest 667:  relative to the <span><code>XMLHttpRequest</code> base URL</span>.
 668:  If the algorithm returns an error raise a <code>SYNTAX_ERR</code>
 669:  exception and terminate these steps.</p></li>
 670: 
 671:  <!-- Presto and Gecko override the encoding. WebKit does not. Trident
 672:  does not support non-ASCII URLs. This matters for the <query> component,
 673:  see HTML5. -->
 674: 
 675:  <li><p>Drop <code>&lt;fragment></code> from <var title="">url</var>.</p></li>
 676: 
 677:  <li><p>If <var title="">url</var> contains an unsupported <code>&lt;scheme></code>
 678:  raise a <code>NOT_SUPPORTED_ERR</code> and terminate these
 679:  steps.</p></li>
 680: 
 681:  <li><p>If the <code>"user:password"</code> format in the
 682:  <code>userinfo</code> production is not supported for the relevant scheme
 683:  and <var title="">url</var> contains this format raise a
 684:  <code>SYNTAX_ERR</code> and terminate these steps.</p></li>
 685: 
 686:  <li><p>If <var title="">url</var> contains the <code>"user:password"</code>
 687:  format let <var>temp user</var> be the user part and
 688:  <var>temp password</var> be the password part.</p></li>
 689: 
 690:  <li><p>If <var title="">url</var> just contains the <code>"user"</code>
 691:  format let <var>temp user</var> be the user part.</p></li>
 692: 
1.248 avankest 693:  
1.203 avankest 694:  <li><p>If the <span>origin</span> of <var title="">url</var> is not
 695:  <span>same origin</span> with the
1.259 avankest 696:  <span><code>XMLHttpRequest</code> origin</span> raise a
 697:  <code>SECURITY_ERR</code> exception and terminate these steps.</p></li>
1.248 avankest 698:  
 699:  
1.203 avankest 700: 
1.211 avankest 701:  <li><p>Let <var>async</var> be the value of the <var>async</var> argument
1.266 avankest 702:  or true if it was omitted.</p></li>
1.203 avankest 703: 
 704:  <li>
 705:   <p>If the <var>user</var> argument was not omitted follow these sub
 706:   steps:</p>
1.90 avankest 707: 
1.203 avankest 708:   <ol>
1.263 avankest 709:   
 710: 
1.203 avankest 711:   <li><p>If the syntax of <var>user</var> does not match the syntax
 712:   specified by the relevant authentication scheme, raise a
 713:   <code>SYNTAX_ERR</code> exception and terminate the overall set of
 714:   steps.</p></li>
1.163 avankest 715: 
1.239 avankest 716:   <li><p>If <var>user</var> is null let <var>temp user</var>
1.203 avankest 717:   be null.</p></li>
1.90 avankest 718: 
1.203 avankest 719:   <li><p>Otherwise let <var>temp user</var> be <var>user</var>.</p></li>
 720:   </ol>
1.88 avankest 721: 
1.203 avankest 722:   <p class="note">These steps override anything that may have been set by
 723:   the <var title="">url</var> argument.</p>
 724:  </li>
1.88 avankest 725: 
1.128 avankest 726:  <li>
1.203 avankest 727:   <p>If the <var>password</var> argument was not omitted follow these sub
 728:   steps:</p>
 729: 
 730:   <ol>
1.263 avankest 731:   
 732: 
1.203 avankest 733:   <li><p>If the syntax of <var>password</var> does not match the syntax
 734:   specified by the relevant authentication scheme, raise a
 735:   <code>SYNTAX_ERR</code> exception and terminate the overall set of
 736:   steps.</p></li>
1.167 avankest 737: 
1.239 avankest 738:   <li><p>If <var>password</var> is null let
1.203 avankest 739:   <var>temp password</var> be null.</p></li>
 740: 
 741:   <li><p>Otherwise let <var>temp password</var> be
 742:   <var>password</var>.</p></li>
 743:   </ol>
 744: 
 745:   <p class="note">These steps override anything that may have been set by
 746:   the <var title="">url</var> argument.</p>
1.128 avankest 747:  </li>
1.88 avankest 748: 
1.203 avankest 749:  <li><p><span title="abort send()">Abort the <code>send()</code> algorithm</span>.</p></li>
 750: 
 751:  <li><p>The user agent <em class="ct">should</em> cancel any network
 752:  activity for which the object is responsible.</p></li>
 753:  <!-- we can hardly require it... -->
 754: 
1.252 avankest 755:  <li><p>If there are any <span title="task">tasks</span> from the object's
 756:  <span><code>XMLHttpRequest</code> task source</span> in one of the
 757:  <span>task queues</span>, then remove those tasks.</p></li>
 758: 
1.203 avankest 759:  <li>
 760:   <p>Set variables associated with the object as follows:</p>
 761: 
 762:   <ul>
 763:   <li><p>Set the <span><code>send()</code> flag</span> to false.</p></li>
 764: 
 765:   <li><p>Set <span>response entity body</span> to null.</p></li>
 766: 
 767:   <li><p>Empty the list of <span>author request headers</span>.</p>
 768: 
 769:   <li><p>Set the <span>request method</span> to <var>method</var>.</p></li>
 770: 
 771:   <li><p>Set the <span>request URL</span> to <var title="">url</var>.</p></li>
1.58 avankest 772: 
1.203 avankest 773:   <li><p>Set the <span>request username</span> to <var>temp user</var>.</p></li>
1.12 avankest 774: 
1.203 avankest 775:   <li><p>Set the <span>request password</span> to <var>temp password</var>.</p></li>
1.12 avankest 776: 
1.266 avankest 777:   <li><p>Set the <span>asynchronous flag</span> to the value of
 778:   <var>async</var>.</p></li>
1.203 avankest 779:   </ul>
 780:  </li>
1.58 avankest 781: 
1.203 avankest 782:  <li><p>Switch the the state to
 783:  <span title="OPENED state">OPENED</span>.</p></li>
1.58 avankest 784: 
1.203 avankest 785:  <li><p><span>Dispatch a <code>readystatechange</code> event</span>.</p></li>
 786:  </ol>
1.248 avankest 787:  
 788:  
1.203 avankest 789:  <p class="note">A future version or extension of this specification will
 790:  define a way of doing cross-origin requests.</p>
1.248 avankest 791:  
1.58 avankest 792: 
1.14 avankest 793: 
1.203 avankest 794:  <h4>The <code title="">setRequestHeader()</code> method</h4>
1.12 avankest 795: 
1.235 avankest 796:  <!-- XXX domintro authors
1.203 avankest 797:  The <code>setRequestHeader()</code> method can be used to set new request
1.184 avankest 798:   headers and append to request headers already in the list.</p>
1.203 avankest 799:  -->
1.45 avankest 800: 
1.203 avankest 801:  <p>As indicated in the algorithm below certain headers cannot be set and
 802:  are left up to the user agent. In addition there are certain other headers
 803:  the user agent will take control of if they are not set by the author as
 804:  indicated at the end of the <code>send()</code> method section.</p>
 805: 
 806:  <p class="note">The <code>setRequestHeader()</code> method appends a
 807:  value if the HTTP header given as argument is already part of the
 808:  <span>author request headers</span> list.</p>
 809: 
1.248 avankest 810:  
 811: 
1.203 avankest 812:  <p>When the
 813:  <dfn id="setrequestheader" title="setrequestheader"><code>setRequestHeader(<var>header</var>,
 814:  <var>value</var>)</code></dfn> method is invoked, the user agent
1.259 avankest 815:  <em class="ct">must</em> run these steps:</p>
1.14 avankest 816: 
1.203 avankest 817:  <ol>
 818:  <li><p>If the state is not <span title="OPENED state">OPENED</span> raise
 819:  an <code>INVALID_STATE_ERR</code> exception and terminate these
 820:  steps.</p></li>
 821: 
 822:  <li><p>If the <span><code>send()</code> flag</span> is true raise an
 823:  <code>INVALID_STATE_ERR</code> exception and terminate these
 824:  steps.</p></li>
 825: 
1.256 avankest 826:  <li><p>If any code point in <var>header</var> is higher than
 827:  U+00FF LATIN SMALL LETTER Y WITH DIAERESIS or after
 828:  <span title="deflate a DOMString into an byte sequence">deflating</span>
 829:  <var>header</var> it does not match the
 830:  <span>field-name</span> production raise a <code>SYNTAX_ERR</code>
 831:  exception and terminate these steps. Otherwise let <var>header</var> be
 832:  the result of
 833:  <span title="deflate a DOMString into an byte sequence">deflating</span>
 834:  <var>header</var>.</p></li> <!-- This sounds lame, but it works. -->
1.203 avankest 835: 
 836:  <li>
1.256 avankest 837:   <p>If any code point in <var>value</var> is higher than
 838:   U+00FF LATIN SMALL LETTER Y WITH DIAERESIS or after
 839:   <span title="deflate a DOMString into an byte sequence">deflating</span>
 840:   <var>value</var> it does not match the
 841:   <span>field-value</span> production raise a <code>SYNTAX_ERR</code>
 842:   exception and terminate these steps. Otherwise let <var>value</var> be
 843:   the result of
 844:   <span title="deflate a DOMString into an byte sequence">deflating</span>
 845:   <var>value</var>.</p> <!-- This sounds lame, but it works. -->
1.203 avankest 846: 
 847:   <p class="note">The empty string is legal and represents the empty
 848:   header value.</p>
 849:  </li>
 850: 
 851:  <li>
1.259 avankest 852:   <p>Terminate these steps if <var>header</var> is a case-insensitive
 853:   match for one of the following headers:</p>
1.203 avankest 854: 
 855:   <ul>
 856:   <li><code>Accept-Charset</code></li>
 857:   <li><code>Accept-Encoding</code></li>
 858:   <li><code>Connection</code></li>
 859:   <li><code>Content-Length</code></li>
 860:   <li><code>Cookie</code></li>
 861:   <li><code>Cookie2</code></li>
 862:   <li><code>Content-Transfer-Encoding</code></li>
 863:   <li><code>Date</code></li>
 864:   <li><code>Expect</code></li>
 865:   <li><code>Host</code></li>
 866:   <li><code>Keep-Alive</code></li>
 867:   <li><code>Referer</code></li>
 868:   <li><code>TE</code></li>
 869:   <li><code>Trailer</code></li>
 870:   <li><code>Transfer-Encoding</code></li>
 871:   <li><code>Upgrade</code></li>
 872:   <li><code>User-Agent</code></li>
 873:   <li><code>Via</code></li>
 874:   </ul>
1.96 avankest 875: 
1.256 avankest 876:   <p>&hellip; or if the start of <var>header</var> is a case-insensitive
 877:   match for <code>Proxy-</code> or <code>Sec-</code> (including when
 878:   <var>header</var> is just <code>Proxy-</code> or <code>Sec-</code>).</p>
1.203 avankest 879: 
 880:   <p class="note">The above headers are not allowed to be set as they are
 881:   better controlled by the user agent as it knows best what value they
1.259 avankest 882:   ought to have. Header names starting with <code>Sec-</code> are not
1.203 avankest 883:   allowed to be set to allow new headers to be minted in the future that
 884:   are guaranteed not to come from <code>XMLHttpRequest</code>. (Older
 885:   clients would however still be vulnerable as they allow such headers to
 886:   be set.)</p>
 887:  </li>
1.14 avankest 888: 
1.203 avankest 889:  <li><p>If <var>header</var> is not in the
 890:  <span>author request headers</span> list append <var>header</var> with
 891:  its associated <var>value</var> to the list and terminate these
 892:  steps.</p></li>
 893: 
 894:  <li><p>If <var>header</var> is in the <span>author request headers</span>
 895:  list either use multiple headers, combine the values or use a combination
 896:  of those (section 4.2, RFC 2616).
 897:  [<cite><span>RFC2616</span></cite>]</p></li>
 898:  <!-- XXX it seems UAs always combine the values -->
 899:  </ol>
1.45 avankest 900: 
1.203 avankest 901:  <p class="note">See also the <code>send()</code> method regarding user
 902:  agent header handling for caching, authentication, proxies, and
 903:  cookies.</p>
1.14 avankest 904: 
1.203 avankest 905:  <div class="example">
 906:  <pre><code>// The following script:
1.14 avankest 907: var client = new XMLHttpRequest();
 908: client.open('GET', 'demo.cgi');
 909: client.setRequestHeader('X-Test', 'one');
 910: client.setRequestHeader('X-Test', 'two');
 911: client.send();
 912: 
 913: // ...would result in the following header being sent:
 914: ...
 915: X-Test: one, two
1.58 avankest 916: ...</code></pre>
1.203 avankest 917:  </div>
1.255 avankest 918: 
1.248 avankest 919:  
1.218 avankest 920: 
1.203 avankest 921: 
 922:  <h4>The <code title="">send()</code> method</h4>
1.12 avankest 923: 
1.235 avankest 924:  <!-- XXX domintro
1.203 avankest 925:  <p>The <code>send()</code> method initiates the request and its optional
1.204 avankest 926:  argument provides the <span>request entity body</span>.</p>
1.235 avankest 927:  -->
1.203 avankest 928: 
 929:  <p>When the
 930:  <dfn id="send" title="send"><code>send(<var>data</var>)</code></dfn>
 931:  method is invoked, the user agent <em class="ct">must</em> run the
 932:  following steps (unless otherwise noted). This algorithm gets aborted when
 933:  the <code>open()</code> or <code>abort()</code> method is invoked. When
 934:  the
 935:  <dfn title="abort send()" id="abort-send-algorithm"><code>send()</code> algorithm is aborted</dfn>
 936:  the user agent <em class="ct">must</em> terminate the algorithm after
 937:  finishing the step it is on.</p>
 938: 
 939:  <p class="note">The <code title="">send()</code> algorithm can only be
 940:  aborted when the <span>asynchronous flag</span> is true and only after the
 941:  method call has returned.</p>
1.181 avankest 942: 
1.203 avankest 943:  <ol>
 944:  <li><p>If the state is not <span title="OPENED state">OPENED</span> raise
 945:  an <code>INVALID_STATE_ERR</code> exception and terminate these
 946:  steps.</p></li>
 947: 
 948:  <li><p>If the <span><code>send()</code> flag</span> is true raise an
 949:  <code>INVALID_STATE_ERR</code> exception and terminate these
 950:  steps.</p></li>
1.58 avankest 951: 
1.203 avankest 952:  <li>
 953:   <p>If the <span>request method</var> is <code>GET</code> or
1.239 avankest 954:   <code>HEAD</code> act as if <var>data</var> is null.</p>
1.232 avankest 955:   
 956:   <p>If the <var>data</var> argument has been omitted or is
1.239 avankest 957:   null, do not include a <span>request entity body</span>
1.232 avankest 958:   and go to the next step.</p>
1.248 avankest 959: 
 960:   <p>Otherwise, let <var>encoding</var> be null, <var>mime type</var> be
 961:   null, and then follow these rules:</p>
1.203 avankest 962: 
 963:   <dl class="switch">
1.248 avankest 964:   
 965:   
 966:   <dt>If <var>data</var> is a <code>Document</code>
1.203 avankest 967: 
 968:   <dd>
1.232 avankest 969:    <p>Let <var>encoding</var> be the <span>preferred MIME name</span> of
 970:    the
 971:    <span title="document's character encoding">character encoding</span>
 972:    of <var>data</var>. If <var>encoding</var> is UTF-16 change it to
 973:    UTF-8.</p>
 974:    
1.248 avankest 975:    <p>Let <var>mime type</var> be "<code>application/xml;charset=</code>"
 976:    followed by <var>encoding</var>.</p>
1.232 avankest 977: 
 978:    <p>Let the <span>request entity body</span> be the result of getting
 979:    the <code title="dom-innerHTML">innerHTML</code> attribute on
1.233 avankest 980:    <var>data</var>
 981:    <span title="convert a DOMString to a sequence of Unicode characters">converted to Unicode</span>
 982:    and encoded as <var>encoding</var>. Re-raise any exception this
 983:    raises.</p>
1.218 avankest 984: 
1.233 avankest 985:    <p class="note">In particular, if the document cannot be serialized an
1.217 avankest 986:    <code>INVALID_STATE_ERR</code> exception is raised.</p>
 987: 
1.203 avankest 988:    <p class="note">Subsequent changes to the <code>Document</code> have
 989:    no effect on what is submitted.</p>
 990:   </dd>
1.237 avankest 991: 
1.248 avankest 992:   <dt>If <var>data</var> is a <code>DOMString</code></dt>
1.237 avankest 993: 
1.248 avankest 994:   <dd>
 995:    <p>Let <var>encoding</var> be UTF-8.</p>
 996:    
 997:    <p>Let <var>mime type</var> be "<code>text/plain;charset=UTF-8</code>".</p>
 998: 
 999:    <p>Let the <span>request entity body</span> be <var>data</var>
 1000:    <span title="convert a DOMString to a sequence of Unicode characters">converted to Unicode</span>
 1001:    and encoded as UTF-8.</p>
 1002:   </dd>
 1003: 
 1004:   
1.203 avankest 1005:   </dl>
1.58 avankest 1006: 
1.232 avankest 1007:   <p>If a <code>Content-Type</code> header is set using
1.248 avankest 1008:   <code>setRequestHeader()</code> whose value is a
 1009:   <span>valid MIME type</span> and has a <code>charset</code>
1.256 avankest 1010:   parameter whose value is not a case-insensitive match for
 1011:   <var>encoding</var>, and <var>encoding</var> is not null, set all the
 1012:   <code>charset</code> parameters of the <code>Content-Type</code> header
 1013:   to <var>encoding</var>.</p>
1.232 avankest 1014: 
 1015:   <p>If no <code>Content-Type</code> header has been set using
1.248 avankest 1016:   <code>setRequestHeader()</code> and <var>mime type</var> is not null set
 1017:   a <code>Content-Type</code> request header with as value
 1018:   <var>mime type</var>.</p>
1.236 avankest 1019: 
 1020:   <!-- reminder: if we ever change this to always include charset it has
 1021:   to be included as the first parameter for compatibility reasons -->
1.203 avankest 1022:  </li>
1.202 avankest 1023: 
1.203 avankest 1024:  <li><p>If the <span>asynchronous flag</span> is false release the
 1025:  <span>storage mutex</span>.</p></li>
1.103 avankest 1026: 
1.248 avankest 1027:  
 1028: 
1.203 avankest 1029:  <li><p>Set the <span>error flag</span> to false.</p></li>
1.218 avankest 1030: 
1.248 avankest 1031:  
 1032: 
1.211 avankest 1033:  <li>
 1034:   <p>If the <span>asynchronous flag</span> is true run these substeps:</p>
1.218 avankest 1035: 
1.211 avankest 1036:   <ol>
1.217 avankest 1037:   <li><p>Set the <span><code>send()</code> flag</span> to true.</p></li>
 1038: 
1.211 avankest 1039:   <li>
 1040:    <p><span>Dispatch a <code>readystatechange</code> event</span>.</p>
1.145 avankest 1041: 
1.211 avankest 1042:    <p class="note">The state does not change. The event is dispatched for
 1043:    historical reasons.</p>
 1044:   </li>
 1045: 
1.248 avankest 1046:   
 1047: 
1.211 avankest 1048:   <li><p>Return the <code>send()</code> method call, but continue running
 1049:   the steps in this algorithm.</p></li>
 1050:   </ol>
 1051:  </li>
1.218 avankest 1052: 
1.203 avankest 1053:  <li>
1.248 avankest 1054:   
1.211 avankest 1055: 
1.261 avankest 1056:    <p><span>Fetch</span> the <span>request URL</span> from
1.260 avankest 1057:    <i title="">origin</i>
 1058:    <span><code>XMLHttpRequest</code> origin</span>, with the
 1059:    <i title="">synchronous flag</i> set if the
 1060:    <span>asynchronous flag</span> is false, using HTTP method
1.248 avankest 1061:    <span>request method</span>, user <span>request username</span> (if
 1062:    non-null) and password <span>request password</span> (if non-null),
 1063:    taking into account the <span>request entity body</span>, list of
 1064:    <span>author request headers</span> and the rules listed at the end of
 1065:    this section.</p>
 1066: 
 1067:    <dl class="switch">
 1068:    <dt>If the <span>asynchronous flag</span> is false</dt>
 1069:    <dd>
 1070:     <p>While making the request also follow the
 1071:     <span>same-origin request event rules</span>.</p>
 1072: 
 1073:     <!--
 1074:     This cannot involve any task queue whatsoever because that would
 1075:     mean other tasks on the task queue might get processed as well
 1076:     which is counter to the whole idea of doing things synchronous.
 1077:     -->
 1078: 
 1079:     <p class="note">The <code>send()</code> method call will now be
 1080:     returned by virtue of this algorithm ending.</p>
 1081:    </dd>
 1082: 
 1083:    <dt>If the <span>asynchronous flag</span> is true</dt>
 1084:    <dd>
 1085:     <p><span>Make progress notifications</span>.</p>
 1086: 
 1087:     <p><span>Make upload progress notifications</span>.</p>
 1088: 
 1089:     <p>While processing the request, as data becomes available and when
 1090:     the user interferes with the request,
1.255 avankest 1091:     <span title="queue a task">queue tasks</span> to update the
 1092:     <span>response entity body</span> and follow the
1.254 avankest 1093:     <span>same-origin request event rules</span>.</p>
1.248 avankest 1094:    </dd>
 1095:    </dl>
 1096:   
1.203 avankest 1097:  </li>
 1098:  </ol>
1.60 avankest 1099: 
1.203 avankest 1100:  <hr>
 1101: 
1.227 avankest 1102:  <p>If the user agent allows the end user to configure a proxy it
1.248 avankest 1103:  <em class="ct">should</em> modify the request appropriately; i.e., connect
 1104:  to the proxy host instead of the origin server, modify the
 1105:  <code>Request-Line</code> and send <code>Proxy-Authorization</code>
 1106:  headers as specified.</p>
1.262 avankest 1107:  
 1108:  <hr>
1.212 avankest 1109: 
1.218 avankest 1110:  <p>If the user agent supports HTTP Authentication and
1.262 avankest 1111:  <code title="http-authorization">Authorization</code> is not in the list
 1112:  of <span>author request headers</span>, it <em class="ct">should</em>
1.218 avankest 1113:  consider requests originating from the <code>XMLHttpRequest</code> object
 1114:  to be part of the protection space that includes the accessed URIs and
1.262 avankest 1115:  send <code title="http-authorization">Authorization</code> headers and
 1116:  handle <code>401 Unauthorized</code> requests appropriately.</p>
 1117: 
 1118:  <p>If authentication fails,
 1119:  <code title="http-authorization">Authorization</code> is not in the list
 1120:  of <span>author request headers</span>, <span>request username</span> is
 1121:  null, and <span>request password</span> is null, user agents
 1122:  <em class="ct">should</em> prompt the end user for their username and
 1123:  password.</p>
 1124:  
 1125:  <p>If authentication fails,
 1126:  <code title="http-authorization">Authorization</code> is not in the list
 1127:  of <span>author request headers</span>, <span>request username</span> is
 1128:  non-null, and <span>request password</span> is non-null, user agents
 1129:  <em class="ct">must not</em> prompt the end user for their username and
 1130:  password. [<cite><span>RFC2617</span></cite>]</p>
1.212 avankest 1131: 
1.266 avankest 1132:  <p class="note">End users are not prompted if username/password are
 1133:  provided through the <code>open()</code> API so that authors can implement
 1134:  their own user interface.</p>
1.262 avankest 1135:  
 1136:  <hr>
1.212 avankest 1137: 
 1138:  <p>If the user agent supports HTTP State Management it
 1139:  <em class="ct">should</em> persist, discard and send cookies (as received
 1140:  in the <code>Set-Cookie</code> and <code>Set-Cookie2</code> response
 1141:  headers, and sent in the <code>Cookie</code> header) as applicable.
 1142:  [<cite><span>COOKIES</span></cite>]</p>
1.262 avankest 1143:  
 1144:  <hr>
1.212 avankest 1145: 
 1146:  <p>If the user agent implements a HTTP cache it <em class="ct">should</em>
1.248 avankest 1147:  respect <code>Cache-Control</code> request headers set by the
 1148:  <code>setRequestHeader()</code> (e.g., <code>Cache-Control:
 1149:  no-cache</code> bypasses the cache). It <em class="ct">must not</em> send
1.212 avankest 1150:  <code>Cache-Control</code> or <code>Pragma</code> request headers
1.227 avankest 1151:  automatically unless the end user explicitly requests such behavior
1.212 avankest 1152:  (e.g. by (force-)reloading the page).</p>
 1153: 
 1154:  <p>For <code>304 Not Modified</code> responses that are a result of a
 1155:  user agent generated conditional request the user agent
 1156:  <em class="ct">must</em> act as if the server gave a <code>200 OK</code>
 1157:  response with the appropriate content. The user agent
 1158:  <em class="ct">must</em> allow <code>setRequestHeader()</code> to
1.248 avankest 1159:  override automatic cache validation by setting request headers (e.g.
 1160:  <code>If-None-Match</code> or <code>If-Modified-Since</code>), in which
1.212 avankest 1161:  case <code>304 Not Modified</code> responses <em class="ct">must</em> be
 1162:  passed through. [<cite><span>RFC2616</span></cite>]</p>
1.262 avankest 1163:  
 1164:  <hr>
1.212 avankest 1165: 
 1166:  <p>If the user agent implements server-driven content-negotiation
 1167:  it <em class="ct">should</em> set <code>Accept-Encoding</code> and
1.231 avankest 1168:  <code>Accept-Charset</code> headers as appropriate. For
 1169:  <code>Accept</code> and <code>Accept-Language</code> the user agent
 1170:  <em class="ct">must</em> follow these constraints:</p>
 1171: 
 1172:  <ul>
 1173:  <li><p>Both headers <em class="ct">must not</em> be modified if they are
 1174:  already set through <code>setRequestHeader()</code>.</p></li>
1.255 avankest 1175: 
1.231 avankest 1176:  <li><p>If not set through <code>setRequestHeader()</code>
1.255 avankest 1177:  <code>Accept-Language</code> <em class="ct">should</em> be set as
1.231 avankest 1178:  appropriate.</p></li>
 1179: 
 1180:  <li><p>If not set through <code>setRequestHeader()</code>
 1181:  <code>Accept</code> <em class="ct">must</em> be set with as value
 1182:  <code>*/*</code>.</p></li>
 1183:  </ul>
 1184: 
 1185:  <p>Responses <em class="ct">must</em> have the content-encodings
 1186:  automatically decoded. [<cite><span>RFC2616</span></cite>]</p>
1.212 avankest 1187: 
1.262 avankest 1188:  <hr>
 1189: 
1.212 avankest 1190:  <p>Besides the <span>author request headers</span> user agents
 1191:  <em class="ct">should not</em> include additional request headers other
1.248 avankest 1192:  than those mentioned above or other than those authors are not allowed to
 1193:  set using <code>setRequestHeader()</code>. This ensures that authors have
 1194:  a reasonably predictable API.</p>
1.218 avankest 1195: 
1.212 avankest 1196: 
 1197:  <h4>Infrastructure for the <code title="">send()</code> method</h4>
1.216 avankest 1198: 
1.219 avankest 1199:  <p>The <dfn>same-origin request event rules</dfn> are as follows:</p>
1.118 avankest 1200: 
1.203 avankest 1201:  <dl class="switch">
 1202:  <dt>If the response is an HTTP redirect</dt>
 1203:  <dd>
1.248 avankest 1204:   
1.257 avankest 1205:   <p>If the <span>origin</span> of the <span>URL</span> conveyed by the
 1206:   <code title="http-location">Location</code> header is
 1207:   <span>same origin</span> with the
 1208:   <span><code>XMLHttpRequest</code> origin</span> and the redirect does
 1209:   not violate infinite loop precautions, transparently follow the redirect
 1210:   while observing the <span>same-origin request event rules</span>.</p>
1.248 avankest 1211:   
 1212:   <p>Otherwise, this is a <span>network error</span>.</p>
 1213:   
 1214:   
1.203 avankest 1215: 
 1216:   <p class="note">HTTP places requirements on the user agent regarding the
1.204 avankest 1217:   preservation of the <span>request method</span> and
1.248 avankest 1218:   <span>request entity body</span> during redirects, and also requires end
 1219:   users to be notified of certain kinds of automatic redirections.</p>
1.203 avankest 1220:   <!-- XXX HTTP needs fixing here -->
1.213 avankest 1221:  </dd>
1.121 avankest 1222: 
1.227 avankest 1223:  <dt>If the end user cancels the download</dt>
1.213 avankest 1224:  <dd><p>This is an <span>abort error</span>.</p></dd>
1.60 avankest 1225: 
1.214 avankest 1226:  <dt>In case of network errors</dt>
1.213 avankest 1227:  <dd>
 1228:   <p>In case of DNS errors, TLS negotiation failure, or other type of
 1229:   network errors, this is a <span>network error</span>. Do not request any
1.227 avankest 1230:   kind of end user interaction.</p>
1.121 avankest 1231: 
1.213 avankest 1232:   <p class="note">This does not include HTTP responses that indicate
 1233:   some type of error, such as HTTP status code 410.</p>
 1234:  </dd>
1.60 avankest 1235: 
1.248 avankest 1236:  
 1237: 
1.213 avankest 1238:  <dt>Once all HTTP headers have been received and the
1.257 avankest 1239:  <span>asynchronous flag</span> is true (and this is not an HTTP
 1240:  redirect)</dt>
1.213 avankest 1241:  <dd><p><span>Switch to the HEADERS_RECEIVED state</span>.</p></dd>
1.186 avankest 1242: 
1.220 avankest 1243:  <dt>Once the first byte (or more) of the
 1244:  <span>response entity body</span> has been received and the
 1245:  <span>asynchronous flag</span> is true</dt>
 1246:  <dt>If there is no <span>response entity body</span> and the
1.213 avankest 1247:  <span>asynchronous flag</span> is true</dt>
1.215 avankest 1248:  <dd><p><span>Switch to the LOADING state</span>.</p></dd>
1.220 avankest 1249:  
 1250:  <dt>Once the whole <span>response entity body</span> has been
 1251:  received</dt>
1.224 avankest 1252:  <dt>If there is no <span>response entity body</span> and the
 1253:  <span>asynchronous flag</span> is false or the state is
1.221 avankest 1254:  <span title="LOADING state">LOADING</span></dt>
1.220 avankest 1255:  <dd><p><span>Switch to the DONE state</span>.</p></dd>
1.213 avankest 1256:  </dl>
1.218 avankest 1257: 
1.248 avankest 1258:  
 1259: 
1.213 avankest 1260:  <hr>
1.218 avankest 1261: 
1.241 avankest 1262:  <p>When something is said to be a <dfn>network error</dfn> run the
 1263:  <span>request error</span> steps for exception
 1264:  <code>NETWORK_ERR</code>.</p>
 1265: 
 1266:  <p>When something is said to be an <dfn>abort error</dfn> run the
 1267:  <span>request error</span> steps for exception
 1268:  <code>ABORT_ERR</code>.</p>
1.60 avankest 1269: 
1.248 avankest 1270:  
 1271: 
1.242 avankest 1272:  <p>When something is said to be a <dfn>request error</dfn> for
1.248 avankest 1273:  exception <var>exception</var> run these
 1274:  steps:</p>
1.12 avankest 1275: 
1.213 avankest 1276:  <ol>
1.254 avankest 1277:  <li><p>The user agent <em class="ct">should</em> cancel any network
 1278:  activity for which the object is responsible.</p></li>
 1279: 
 1280:  <li><p>If there are any <span title="task">tasks</span> from the object's
 1281:  <span><code>XMLHttpRequest</code> task source</span> in one of the
 1282:  <span>task queues</span>, then remove those tasks.</p></li>
1.250 avankest 1283: 
1.213 avankest 1284:  <li><p>Set the <span>response entity body</span> to null.</p></li>
1.203 avankest 1285: 
1.254 avankest 1286:  <li><p>Empty the list of <span>author request headers</span>.</p></li>
 1287: 
1.213 avankest 1288:  <li><p>Set the the <span>error flag</span> to true.</p></li>
1.12 avankest 1289: 
1.213 avankest 1290:  <li><p>Switch the state to <span title="DONE state">DONE</span>.</p></li>
1.203 avankest 1291: 
1.241 avankest 1292:  <li><p>If the <span>asynchronous flag</span> is false raise an
 1293:  <var>exception</var> exception and terminate the overall set of
1.213 avankest 1294:  steps.</p></li>
1.203 avankest 1295: 
1.248 avankest 1296:  <li>
1.249 avankest 1297:   <p><span>Dispatch a <code>readystatechange</code> event</span>.</p>
1.248 avankest 1298: 
 1299:   <p class="note">At this point it is clear that the
 1300:   <span>asynchronous flag</span> is true.</p>
 1301:  </li>
 1302: 
 1303:  
1.203 avankest 1304: 
1.248 avankest 1305:  <li><p>Terminate the overall algorithm.</p></li>
1.213 avankest 1306:  </ol>
1.203 avankest 1307: 
1.248 avankest 1308:  
 1309:  <p class="note">A future version of this specification will dispatch an
 1310:  <code>error</code>/<code>abort</code> event here as well. (Depending on
 1311:  the type of error.)</p>
 1312:  
1.203 avankest 1313: 
1.213 avankest 1314:  <hr>
1.203 avankest 1315: 
1.213 avankest 1316:  <p>When it is said to
 1317:  <dfn id="switch-headers-received">switch to the HEADERS_RECEIVED state</dfn>
 1318:  run these steps:</p>
1.203 avankest 1319: 
1.213 avankest 1320:  <ol>
 1321:  <li><p>Switch the state to <span title="HEADERS_RECEIVED state">HEADERS_RECEIVED</span>.</p></li>
1.203 avankest 1322: 
1.249 avankest 1323:  <li><p><span>Dispatch a <code>readystatechange</code> event</span>.</p></li>
1.213 avankest 1324:  </ol>
1.218 avankest 1325: 
1.213 avankest 1326:  <p>When it is said to
 1327:  <dfn id="switch-loading">switch to the LOADING state</dfn> run these
 1328:  steps:</p>
1.218 avankest 1329: 
1.213 avankest 1330:  <ol>
 1331:  <li><p>Switch the state to <span title="LOADING state">LOADING</span>.</p></li>
1.203 avankest 1332: 
1.249 avankest 1333:  <li><p><span>Dispatch a <code>readystatechange</code> event</span>.</p></li>
1.213 avankest 1334:  </ol>
1.218 avankest 1335: 
1.216 avankest 1336:  <p>When it is said to
 1337:  <dfn id="switch-done">switch to the DONE state</dfn> run these steps:</p>
1.218 avankest 1338: 
1.216 avankest 1339:  <ol>
1.255 avankest 1340:  <li><p>If the <span>asynchronous flag</span> is false update the
 1341:  <span>response entity body</span>.</p></li>
 1342: 
1.216 avankest 1343:  <li><p>Switch the state to <span title="DONE state">DONE</span>.</p></li>
 1344: 
1.248 avankest 1345:  <li><p><span>Dispatch a <code>readystatechange</code> event</span>.</p></li>
 1346: 
1.220 avankest 1347:  
1.216 avankest 1348:  </ol>
1.218 avankest 1349: 
1.248 avankest 1350:  
 1351: 
1.203 avankest 1352: 
 1353:  <h4>The <code title="">abort()</code> method</h4>
 1354: 
 1355:  <p>When the <dfn id="abort"><code>abort()</code></dfn> method is invoked,
1.217 avankest 1356:  the user agent <em class="ct">must</em> run these steps (unless otherwise
 1357:  noted):</p>
1.12 avankest 1358: 
1.203 avankest 1359:  <ol>
 1360:  <li><p><span title="abort send()">Abort the <code>send()</code> algorithm</span>.</p></li>
 1361: 
 1362:  <li><p>The user agent <em class="ct">should</em> cancel any network
 1363:  activity for which the object is responsible.</p></li>
1.252 avankest 1364: 
 1365:  <li><p>If there are any <span title="task">tasks</span> from the object's
 1366:  <span><code>XMLHttpRequest</code> task source</span> in one of the
 1367:  <span>task queues</span>, then remove those tasks.</p></li>
1.203 avankest 1368: 
 1369:  <li><p>Set the <span>response entity body</span> to null.</p></li>
 1370: 
1.252 avankest 1371:  <li><p>Empty the list of <span>author request headers</span>.</p></li>
 1372: 
1.203 avankest 1373:  <li><p>Set the <span>error flag</span> to true.</p></li>
 1374: 
 1375:  <li>
 1376:   <p>If the state is <span title="UNSENT state">UNSENT</span>,
 1377:   <span title="OPENED state">OPENED</span> with the
 1378:   <span><code>send()</code> flag</span> being false, or
 1379:   <span title="DONE state">DONE</span> go to the next step.</p>
1.12 avankest 1380: 
1.203 avankest 1381:   <p>Otherwise run these substeps:</p>
1.58 avankest 1382: 
 1383:   <ol>
1.203 avankest 1384:   <li><p>Switch the state to <span title="DONE state">DONE</span>.</p></li>
1.170 avankest 1385: 
1.203 avankest 1386:   <li><p>Set the <span><code>send()</code> flag</span> to false.</p></li>
1.96 avankest 1387: 
1.203 avankest 1388:   <li><p><span>Dispatch a <code>readystatechange</code> event</span>.</p></li>
1.248 avankest 1389: 
 1390:   
1.58 avankest 1391:   </ol>
1.250 avankest 1392: 
1.248 avankest 1393:   
1.250 avankest 1394:   <p class="note">A future version of this specification will dispatch an
 1395:   <code title="abort-event">abort</code> event here.</p>
1.248 avankest 1396:   
1.203 avankest 1397:  </li>
 1398: 
 1399:  <li>
 1400:   <p>Switch the state to <span title="UNSENT state">UNSENT</span>.</p>
 1401: 
 1402:   <p class="note">No <code>readystatechange</code> event is dispatched.</p>
 1403:  </li>
 1404:  </ol>
 1405: 
 1406: 
 1407: 
1.205 avankest 1408:  <h3 id="response">Response</h3>
1.203 avankest 1409: 
 1410:  <h4>The <code title="">status</code> attribute</h4>
 1411: 
 1412:  <p>The <dfn id="status"><code>status</code></dfn> attribute
1.222 avankest 1413:  <em class="ct">must</em> return the result of running these steps:</p>
1.226 avankest 1414: 
1.222 avankest 1415:  <ol>
 1416:  <li><p>If the state is <span title="UNSENT state">UNSENT</span> or
1.239 avankest 1417:  <span title="OPENED state">OPENED</span> return 0 and terminate these
1.222 avankest 1418:  steps.</p></li>
 1419: 
1.239 avankest 1420:  <li><p>If the <span>error flag</span> is true return 0 and terminate
 1421:  these steps.</p></li>
1.222 avankest 1422:  
 1423:  <li><p>Return the HTTP status code.</p></li>
1.248 avankest 1424:  </ol> 
1.203 avankest 1425: 
 1426: 
 1427:  <h4>The <code title="">statusText</code> attribute</h4>
 1428: 
 1429:  <p>The <dfn id="statustext"><code>statusText</code></dfn> attribute
1.222 avankest 1430:  <em class="ct">must</em> return the result of running these steps:</p>
 1431:  
 1432:  <ol>
 1433:  <li><p>If the state is <span title="UNSENT state">UNSENT</span> or
1.239 avankest 1434:  <span title="OPENED state">OPENED</span> return the empty string and
 1435:  terminate these steps.</p></li>
1.222 avankest 1436: 
 1437:  <li><p>If the <span>error flag</span> is true return the empty string and
 1438:  terminate these steps.</p></li>
 1439:  
 1440:  <li><p>Return the HTTP status text.</p></li>
 1441:  </ol>
1.203 avankest 1442: 
 1443: 
 1444:  <h4>The <code title="">getResponseHeader()</code> method</h4>
 1445: 
 1446:  <p>When the
 1447:  <dfn id="getresponseheader" title="getresponseheader"><code>getResponseHeader(<var>header</var>)</code></dfn>
1.217 avankest 1448:  is invoked, the user agent <em class="ct">must</em> run these steps:</p>
1.203 avankest 1449: 
 1450:  <ol>
 1451:  <li><p>If the state is <span title="UNSENT state">UNSENT</span> or
1.239 avankest 1452:  <span title="OPENED state">OPENED</span> return null and terminate these
1.203 avankest 1453:  steps.</p></li>
 1454: 
1.239 avankest 1455:  <li><p>If the <span>error flag</span> is true return null
1.203 avankest 1456:  and terminate these steps.</p></li>
 1457: 
1.256 avankest 1458:  <li><p>If any code point in <var>header</var> is higher than
 1459:  U+00FF LATIN SMALL LETTER Y WITH DIAERESIS return null and terminate
 1460:  these steps.</p></li>
 1461:  
 1462:  <li><p>Let <var>header</var> be the result of
 1463:  <span title="deflate a DOMString into an byte sequence">deflating</span>
 1464:  <var>header</var>.</p></li> <!-- This sounds lame, but it works. -->
 1465: 
 1466:  <li><p>If <var>header</var> is a case-insensitive match for
 1467:  <code>Set-Cookie</code> or <code>Set-Cookie2</code> return null and
 1468:  terminate these steps.</p></li>
1.203 avankest 1469: 
1.256 avankest 1470:  <li><p>If <var>header</var> is a case-insensitive match for multiple HTTP
 1471:  response headers, return the
 1472:  <span title="inflate an byte sequence into a DOMString">inflated</span>
 1473:  values of these headers as a single concatenated string separated from
 1474:  each other by a U+002C COMMA U+0020 SPACE character pair and terminate
 1475:  these steps.</p></li>
1.203 avankest 1476: 
1.256 avankest 1477:  <li><p>If <var>header</var> is a case-insensitive match for a single HTTP
 1478:  response header, return the
 1479:  <span title="inflate an byte sequence into a DOMString">inflated</span>
 1480:  value of that header and terminate these steps.</p></li>
1.203 avankest 1481: 
1.239 avankest 1482:  <li><p>Return null.</p></li>
1.203 avankest 1483:  </ol>
 1484: 
1.248 avankest 1485:  
 1486: 
1.203 avankest 1487:  <div class="example">
1.250 avankest 1488:  
 1489:  <p>For the following script:</p>
 1490: 
 1491:  <pre><code>var client = new XMLHttpRequest();
 1492: client.open("GET", "unicorns-are-teh-awesome.txt", true);
1.5 avankest 1493: client.send();
1.12 avankest 1494: client.onreadystatechange = function() {
1.250 avankest 1495:  if(this.readyState == 2) {
 1496:   print(client.getResponseHeader("Content-Type"));
 1497:  }
 1498: }</code></pre>
 1499: 
 1500:  <p>The <code>print()</code> function will get to process something
 1501:  like:</p>
1.5 avankest 1502: 
1.250 avankest 1503:  <pre><code>text/plain; charset=UTF-8</code></pre>
1.203 avankest 1504:  </div>
1.12 avankest 1505: 
 1506: 
1.203 avankest 1507:  <h4>The <code title="">getAllResponseHeaders()</code> method</h4>
1.14 avankest 1508: 
1.203 avankest 1509:  <p>When the
 1510:  <dfn id="getallresponseheaders"><code>getAllResponseHeaders()</code></dfn>
 1511:  method is invoked, the user agent <em class="ct">must</em> run the
 1512:  following steps:</p>
1.58 avankest 1513: 
1.203 avankest 1514:  <ol>
 1515:  <li><p>If the state is <span title="UNSENT state">UNSENT</span> or
1.239 avankest 1516:  <span title="OPENED state">OPENED</span> return the empty string and
 1517:  terminate these steps.</p></li>
1.203 avankest 1518: 
 1519:  <li><p>If the <span>error flag</span> is true return the empty string and
 1520:  terminate these steps.</p></li>
 1521: 
1.256 avankest 1522:  <li><p>Return all the HTTP headers, excluding headers that are a
 1523:  case-insensitive match for <code>Set-Cookie</code> or
 1524:  <code>Set-Cookie2</code>,
 1525:  <span title="inflate an byte sequence into a DOMString">inflated</span>,
 1526:  as a single string, with each header line
 1527:  separated by a U+000D CR U+000A LF pair, excluding the status line, and
1.203 avankest 1528:  with each header name and header value separated by a
 1529:  U+003A COLON U+0020 SPACE pair.</p></li>
 1530:  </ol>
1.58 avankest 1531: 
1.250 avankest 1532:  
 1533: 
1.203 avankest 1534:  <div class="example">
1.250 avankest 1535:  <p>For the following script:</p>
 1536:  
 1537:  <pre><code>var client = new XMLHttpRequest();
 1538: client.open("GET", "narwhals-too.txt", true);
1.5 avankest 1539: client.send();
1.12 avankest 1540: client.onreadystatechange = function() {
1.179 avankest 1541: if(this.readyState == 2) {
1.203 avankest 1542:  print(this.getAllResponseHeaders());
1.12 avankest 1543: }
1.250 avankest 1544: }</code></pre>
 1545: 
 1546:  <p>The <code>print()</code> function will get to process something
 1547:  like:</p>
1.1 avankest 1548: 
1.250 avankest 1549:  <pre><code>Date: 2004年10月24日 04:58:38 GMT
1.203 avankest 1550: Server: Apache/1.3.31 (Unix)
 1551: Keep-Alive: timeout=15, max=99
 1552: Connection: Keep-Alive
 1553: Transfer-Encoding: chunked
 1554: Content-Type: text/plain; charset=utf-8</code></pre>
 1555:  </div>
 1556: 
1.250 avankest 1557: 
1.203 avankest 1558: 
 1559:  <h4>Response Entity Body</h4>
 1560: 
1.248 avankest 1561:  <p>The <dfn id="response-mime-type">response MIME type</dfn> is the MIME
 1562:  type the <code>Content-Type</code> header contains without any
 1563:  parameters or null if the header could not be parsed properly or was
 1564:  omitted. The <dfn id="override-mime-type">override MIME type</dfn> is
 1565:  always null. <dfn id="final-mime-type">Final MIME type</dfn> is the
 1566:  override MIME type unless that is null in which case it is the response
 1567:  MIME type.</p>
 1568: 
 1569:  <p>The <dfn id="response-charset">response charset</dfn> is the value of
 1570:  the <code>charset</code> parameter of the <code>Content-Type</code> header
 1571:  or null if there was no <code>charset</code> parameter or if
 1572:  the header could not be parsed properly or was omitted. The
 1573:  <dfn id="override-charset">override charset</dfn> is always null.
 1574:  <dfn id="final-charset">Final charset</dfn> is the override charset unless
 1575:  that is null in which case it is the response charset.</p>
1.250 avankest 1576: 
1.248 avankest 1577:  
 1578:  <p class="note"><span>Override MIME type</span> and
 1579:  <span>override charset</span> are introduced here solely to make editing
 1580:  several levels of XMLHttpRequest simultaneously somewhat easier. Apologies
 1581:  for any confusion they might cause.</p>
 1582:  
1.250 avankest 1583: 
1.248 avankest 1584:  <hr>
 1585: 
1.203 avankest 1586:  <p>The <dfn id="response-entity-body">response entity body</dfn> is the
1.255 avankest 1587:  fragment of the <span>entity body</span> of the response received so far
 1588:  (<span title="LOADING state">LOADING</span>) or the complete entity body
 1589:  of the response (<span title="DONE state">DONE</span>). If the response
 1590:  does not have an entity body the response entity body is null.</p>
 1591: 
 1592:  <p class="note">The <span>response entity body</span> is updated as part
 1593:  of the <code>send()</code> algorithm.</p>
1.250 avankest 1594: 
1.203 avankest 1595:  <hr>
 1596: 
 1597:  <p>The <dfn id="text-response-entity-body">text response entity body</dfn>
1.248 avankest 1598:  is a <code>DOMString</code> representing the <span>response entity
 1599:  body</span>. The text response entity body is the return value of the
1.203 avankest 1600:  following algorithm:</p>
 1601: 
 1602:  <ol>
1.248 avankest 1603:  <li><p>If the response entity body is null return the empty string and
 1604:  terminate these steps.</p>
 1605: 
 1606:  <li><p>Let <var>charset</var> be the <span>final charset</span>.</p></li>
1.203 avankest 1607: 
1.248 avankest 1608:  <li><p>Let <var>mime</var> be the <span>final MIME type</span>.</p></li>
1.203 avankest 1609: 
1.248 avankest 1610:  <li><p>If <var>charset</var> is null and <var>mime</var> is null,
1.203 avankest 1611:  <code>text/xml</code>, <code>application/xml</code> or ends in
1.248 avankest 1612:  <code title="">+xml</code> use the rules set forth in the XML
 1613:  specifications to determine the character encoding. Let
 1614:  <var>charset</var> be the determined character encoding.</p></li>
 1615: 
 1616:  <li><p>If <var>charset</var> is null and <var>mime</var> is
 1617:  <code>text/html</code> follow the rules set forth in the HTML
 1618:  specification to determine the character encoding. Let
1.203 avankest 1619:  <var>charset</var> be the determined character encoding.
 1620:  [<cite><span>HTML5</span></cite>]</p></li>
 1621: 
 1622:  <li>
 1623:   <p>If <var>charset</var> is null then, for each of the rows in the
 1624:   following table, starting with the first one and going down, if the first
 1625:   bytes of <var>bytes</var> match the bytes given in the first column, then
 1626:   let <var>charset</var> be the encoding given in the cell in the second
 1627:   column of that row. If there is no match <var>charset</var> remains
 1628:   null.</p>
 1629: 
 1630:   <table>
 1631:   <thead>
 1632:    <tr>
 1633:    <th>Bytes in Hexadecimal
 1634:    <th>Description
1.237 avankest 1635:   <tbody>
1.203 avankest 1636:    <tr>
 1637:    <td>FE FF
 1638:    <td>UTF-16BE BOM
 1639:    <tr>
 1640:    <td>FF FE
 1641:    <td>UTF-16LE BOM
 1642:    <tr>
 1643:    <td>EF BB BF
1.237 avankest 1644:    <td>UTF-8 BOM
1.203 avankest 1645:   </table>
 1646:  </li>
 1647: 
 1648:  <li><p>If <var>charset</var> is null let <var>charset</var> be
 1649:  UTF-8.</p></li>
 1650: 
 1651:  <li><p>Return the result of decoding the response entity body using
 1652:  <var>charset</var>. Replace bytes or sequences of bytes that are not
1.248 avankest 1653:  valid accordng to the <var>charset</var> with a single
 1654:  U+FFFD REPLACEMENT CHARACTER character.</p></li>
1.203 avankest 1655:  </ol>
 1656: 
 1657:  <p class="note">Authors are strongly encouraged to encode their resources
 1658:  using UTF-8.</p>
1.248 avankest 1659:  
1.203 avankest 1660:  <hr>
 1661: 
1.248 avankest 1662:  <p>The <dfn id="document-response-entity-body">document response entity
 1663:  body</dfn> is either a <code>Document</code> representing the
 1664:  <span>response entity body</span> or null. The document
 1665:  response entity body is the return value of the following algorithm:</p>
1.12 avankest 1666: 
1.203 avankest 1667:  <ol>
 1668:  <li><p>If the <span>response entity body</span> is null terminate these
1.239 avankest 1669:  steps and return null.</p></li>
1.12 avankest 1670: 
1.248 avankest 1671:  <li><p>If <span>final MIME type</span> is not null,
 1672:  <code>text/xml</code>,
 1673:  <code>application/xml</code>, and does not end in
 1674:  <code title="">+xml</code> terminate these steps and return
 1675:  null.</li>
 1676: 
 1677:  
1.203 avankest 1678: 
 1679:  <li>
1.265 avankest 1680:   <p>Let <var>document</var> be a
 1681:   <span>cookie-free <code>Document</code> object</span> that represents
 1682:   the result of parsing the response entity body into a document tree
 1683:   following the rules from the XML specifications. If this fails
 1684:   (unsupported character encoding, namespace well-formedness error et
 1685:   cetera) terminate these steps return null.
 1686:   [<cite><span>XML</span></cite>]</p>
1.248 avankest 1687: 
 1688:   <p class="note">Scripts in the resulting document tree will not be executed,
 1689:   resources referenced will not be loaded and no associated XSLT will be
 1690:   applied.</p>
1.203 avankest 1691:  </li>
1.88 avankest 1692: 
1.248 avankest 1693:  <li><p>Return <var>document</var>.</p></li>
1.203 avankest 1694:  </ol>
1.12 avankest 1695: 
 1696: 
1.248 avankest 1697:  
 1698: 
 1699: 
1.203 avankest 1700:  <h4>The <code title="">responseText</code> attribute</h4>
1.12 avankest 1701: 
1.203 avankest 1702:  <p>The <dfn id="responsetext"><code>responseText</code></dfn> attribute
1.217 avankest 1703:  <em class="ct">must</em> return the result of running these steps:</p>
1.79 avankest 1704: 
1.203 avankest 1705:  <ol>
1.248 avankest 1706:  <li><p>If the state is not <span title="LOADING state">LOADING</span> or
 1707:  <span title="DONE state">DONE</span> return the empty string and
1.203 avankest 1708:  terminate these steps.</p></li>
1.75 avankest 1709: 
1.203 avankest 1710:  <li><p>Return the <span>text response entity body</span>.</p></li>
 1711:  </ol>
1.12 avankest 1712: 
 1713: 
1.203 avankest 1714:  <h4>The <code title="">responseXML</code> attribute</h4>
1.12 avankest 1715: 
1.203 avankest 1716:  <p>The <dfn id="responsexml"><code>responseXML</code></dfn> attribute
1.217 avankest 1717:  <em class="ct">must</em> return the result of running these steps:</p>
1.12 avankest 1718: 
1.203 avankest 1719:  <ol>
 1720:  <li><p>If the state is not <span title="DONE state">DONE</span> return
1.239 avankest 1721:  null and terminate these steps.</p></li>
1.12 avankest 1722: 
1.248 avankest 1723:  <li><p>Return the <span>document response entity body</span>.</p></li>
1.203 avankest 1724:  </ol>
1.121 avankest 1725: 
1.248 avankest 1726:  
 1727: 
1.12 avankest 1728: 
1.240 avankest 1729:  <h2 id="exceptions">Exceptions</h2>
1.24 avankest 1730: 
1.138 avankest 1731:  <p>Several algorithms in this specification may result in an exception
 1732:  being thrown. These exceptions are all part of the group
1.185 avankest 1733:  <code>ExceptionCode</code> and use the <code>DOMException</code> object,
1.138 avankest 1734:  which is defined in DOM Level 3 Core. In addition this specification
 1735:  extends the <code>ExceptionCode</code> group with several new
 1736:  constants as indicated below. [<cite><span>DOM3Core</span></cite>]</p>
1.203 avankest 1737: 
1.193 avankest 1738:  <p class="note">Thus, exceptions used by this specification and not
 1739:  defined in this section are defined by DOM Level 3 Core.</p>
1.31 avankest 1740: 
1.138 avankest 1741:  <pre class="idl">const unsigned short <span>SECURITY_ERR</span> = 18;
1.199 avankest 1742: const unsigned short <span>NETWORK_ERR</span> = 19;
 1743: const unsigned short <span>ABORT_ERR</span> = 20;</pre>
1.31 avankest 1744: 
1.138 avankest 1745:  <p>The <dfn id="security-err"><code>SECURITY_ERR</code></dfn> exception is
 1746:  raised if an attempt is made to perform an operation or access some data
 1747:  in a way that would be a security risk or a violation of the user agent's
 1748:  security policy.</p>
 1749: 
 1750:  <!-- http://lists.w3.org/Archives/Public/public-webapi/2006May/0027.html -->
 1751: 
1.33 avankest 1752:  <p>The <dfn id="network-err"><code>NETWORK_ERR</code></dfn> exception is
1.138 avankest 1753:  raised when a network error occurs in synchronous requests.</p>
1.121 avankest 1754: 
1.138 avankest 1755:  <p>The <dfn id="abort-err"><code>ABORT_ERR</code></dfn> exception is
 1756:  raised when the user aborts a request in synchronous requests.</p>
1.248 avankest 1757:  
 1758:  
1.203 avankest 1759: 
1.240 avankest 1760:  <p class="note">These exceptions will be folded into an update of
1.199 avankest 1761:  DOM Level 3 Core in due course, as they are appropriate for other API
 1762:  specifications as well.</p>
1.121 avankest 1763: 
1.248 avankest 1764:  
1.29 avankest 1765:  <h2 class="no-num" id="notcovered">Not in this Specification</h2>
 1766: 
1.143 avankest 1767:  <p><em>This section is non-normative.</em></p>
1.29 avankest 1768: 
1.72 avankest 1769:  <p>This specification does not include the following features which are
 1770:  being considered for a future version of this specification:</p>
1.29 avankest 1771: 
 1772:  <ul>
 1773:  <li><code>load</code> event and <code>onload</code> attribute;</li>
 1774:  <li><code>error</code> event and <code>onerror</code> attribute;</li>
 1775:  <li><code>progress</code> event and <code>onprogress</code> attribute;</li>
 1776:  <li><code title="">abort</code> event and <code>onabort</code> attribute;</li>
 1777:  <li>Timers have been suggested, perhaps an <code>ontimeout</code>
 1778:   attribute;</li>
 1779:  <li>Property to disable following redirects;</li>
1.30 avankest 1780:  <li><code title="">responseXML</code> for <code>text/html</code>
 1781:  documents;</li>
1.203 avankest 1782:  <li>Cross-origin <code title="">XMLHttpRequest</code>;</li>
1.87 avankest 1783:  <li><code>responseBody</code> to deal with byte streams;</li>
1.114 avankest 1784:  <li><code>overrideMimeType</code> to fix up MIME types;</li>
1.87 avankest 1785:  <li><code>getRequestHeader()</code> and
 1786:  <code>removeRequestHeader()</code>.</li>
1.29 avankest 1787:  </ul>
1.248 avankest 1788:  
1.29 avankest 1789: 
1.203 avankest 1790: 
1.248 avankest 1791:  
 1792: 
1.203 avankest 1793: 
1.248 avankest 1794:  <h2 class="no-num" id="references">References</h2>
1.203 avankest 1795: 
1.177 avankest 1796:  <p>Unless marked "Non-normative" these references are normative.</p>
1.11 avankest 1797: 
1.6 avankest 1798:  <dl>
1.230 avankest 1799:  <dt>[<dfn id="ref-cookies">COOKIES</dfn>]</dt>
1.268 ! avankest 1800:  <dd><cite><a href="http://tools.ietf.org/html/draft-ietf-httpstate-cookie">HTTP
 ! 1801:  State Management Mechanism</a></cite> (work in progress), A. Barth. IETF.</dd>
1.203 avankest 1802: 
1.248 avankest 1803:  
 1804: 
1.155 avankest 1805:  <dt>[<dfn id="ref-dom2events">DOM2Events</dfn>]</dt>
 1806:  <dd><cite><a href="http://www.w3.org/TR/DOM-Level-2-Events/">Document
1.267 avankest 1807:  Object Model (DOM) Level 2 Events Specification</a></cite>, T. Pixley.
 1808:  W3C.</dd>
1.155 avankest 1809: 
1.145 avankest 1810:  <dt>[<dfn id="ref-dom3core">DOM3Core</dfn>]</dt>
1.11 avankest 1811:  <dd><cite><a href="http://www.w3.org/TR/DOM-Level-3-Core">Document Object
1.92 avankest 1812:  Model (DOM) Level 3 Core Specification</a></cite>, A. Le Hors, P. Le
1.267 avankest 1813:  H&eacute;garet, L. Wood, G. Nicol, J. Robie, M. Champion, S. Byrne.
 1814:  W3C.</dd>
1.11 avankest 1815: 
1.117 avankest 1816:  <dt>[<dfn id="ref-ecmascript">ECMAScript</dfn>]</dt>
1.92 avankest 1817:  <dd><cite><a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMAScript
1.267 avankest 1818:  Language Specification</a></cite>. ECMA.</dd>
1.248 avankest 1819:  
 1820:  
1.171 avankest 1821: 
1.145 avankest 1822:  <dt>[<dfn id="ref-html5">HTML5</dfn>]</dt>
1.250 avankest 1823:  <dd><cite><a href="http://www.w3.org/html/wg/html5/">HTML5</a></cite>
1.267 avankest 1824:  (work in progress), I. Hickson. W3C.</dd>
1.250 avankest 1825:  <dd><cite><a href="http://www.whatwg.org/specs/html5/current-work/">HTML5</a></cite>
1.267 avankest 1826:  (work in progress), I. Hickson. WHATWG.</dd>
1.198 avankest 1827: 
 1828:  <dt>[<dfn id="ref-httpverbsec">HTTPVERBSEC</dfn>]</dt>
1.248 avankest 1829:  <dd>(Non-normative)
 1830:  <cite><a href="http://www.kb.cert.org/vuls/id/867593">Multiple vendors'
 1831:  web servers enable HTTP TRACE method by default</a></cite>, US-CERT.</dd>
 1832:  <dd>(Non-normative)
 1833:  <cite><a href="http://www.kb.cert.org/vuls/id/288308">Microsoft Internet
 1834:  Information Server (IIS) vulnerable to cross-site scripting via HTTP
 1835:  TRACK method</a></cite>, US-CERT.</dd>
 1836:  <dd>(Non-normative)
 1837:  <cite><a href="http://www.kb.cert.org/vuls/id/150227">HTTP proxy default
 1838:  configurations allow arbitrary TCP connections</a></cite>, US-CERT.</dd>
 1839: 
 1840:  
 1841: 
 1842:  <dt>[<dfn id="ref-rfc2046">RFC2046</dfn>]</dt>
 1843:  <dd><cite><a href="http://ietf.org/rfc/rfc2046">Multipurpose Internet Mail
 1844:  Extensions (MIME) Part Two: Media Types</a></cite>, N. Freed, N.
1.267 avankest 1845:  Borenstein. IETF.</dd>
1.198 avankest 1846: 
1.145 avankest 1847:  <dt>[<dfn id="ref-rfc2119">RFC2119</dfn>]</dt>
1.117 avankest 1848:  <dd><cite><a href="http://ietf.org/rfc/rfc2119">Key words for use in RFCs to
1.267 avankest 1849:  Indicate Requirement Levels</a></cite>, S. Bradner. IETF.</dd>
1.12 avankest 1850: 
1.248 avankest 1851:  <dt>[<dfn id="rfc-rfc2616">RFC2616</dfn>]</dt>
1.11 avankest 1852:  <dd><cite><a href="http://ietf.org/rfc/rfc2616">Hypertext Transfer Protocol
1.92 avankest 1853:  -- HTTP/1.1</a></cite>, R. Fielding, J. Gettys, J. Mogul, H. Frystyk, L.
1.267 avankest 1854:  Masinter, P. Leach, T. Berners-Lee. IETF.</dd>
1.12 avankest 1855: 
1.37 avankest 1856:  <dt>[<dfn id="ref-rfc2617">RFC2617</dfn>]</dt>
1.11 avankest 1857:  <dd><cite><a href="http://ietf.org/rfc/rfc2617">HTTP Authentication: Basic
1.92 avankest 1858:  and Digest Access Authentication</a></cite>, P. Hallam-Baker, J.
1.267 avankest 1859:  Hostetler, S. Lawrence, P. Leach, A. Luotonen, L. Stewart. IETF.</dd>
1.12 avankest 1860: 
1.37 avankest 1861:  <dt>[<dfn id="ref-rfc3986">RFC3986</dfn>]</dt>
1.11 avankest 1862:  <dd><cite><a href="http://ietf.org/rfc/rfc3986">Uniform Resource Identifier
1.267 avankest 1863:  (URI): Generic Syntax</a></cite>, T. Berners-Lee, R. Fielding, L.
 1864:  Masinter. IETF.</dd>
1.184 avankest 1865: 
1.248 avankest 1866:  <dt>[<dfn id=ref-rfc3987>RFC3987</dfn>]</dt>
 1867:  <dd><cite><a href="http://ietf.org/rfc/rfc3987">Internationalized
1.267 avankest 1868:  Resource Identifiers (IRIs)</a></cite>, M. Duerst, M. Suignard.
 1869:  IETF.</dd>
1.248 avankest 1870: 
1.203 avankest 1871:  <dt>[<dfn id="ref-webidl">WebIDL</dfn>]</dt>
1.200 avankest 1872:  <dd><cite><a href="http://dev.w3.org/2006/webapi/WebIDL/">Web
1.267 avankest 1873:  IDL</a></cite> (work in progress), C. McCormack. W3C.</dd> <!-- XXX add Sam -->
1.181 avankest 1874: 
1.92 avankest 1875:  <dt>[<dfn id="ref-xml">XML</dfn>]</dt>
 1876:  <dd><cite><a href="http://www.w3.org/TR/xml/">Extensible Markup Language
1.267 avankest 1877:  (XML) 1.0</a></cite>, T. Bray, J. Paoli, C. Sperberg-McQueen, E. Maler,
 1878:  F. Yergeau. W3C.</dd>
 1879:  <dd><cite><a href="http://www.w3.org/TR/xml-names/">Namespaces in
 1880:  XML</a></cite>, T. Bray, D. Hollander, A. Layman, R. Tobin, H. S.
 1881:  Thompson. W3C.</dd>
1.1 avankest 1882:  </dl>
1.11 avankest 1883: 
1.203 avankest 1884: 
 1885: 
1.130 avankest 1886:  <h2 class="no-num" id="acknowledgments">Acknowledgments</h2>
1.11 avankest 1887: 
1.159 avankest 1888:  <p>The editor would like to thank
1.12 avankest 1889: 
1.163 avankest 1890:  Addison Phillips,
1.159 avankest 1891:  Ahmed Kamel,
 1892:  Alex Hopmann,
 1893:  Alex Vincent,
 1894:  Alexey Proskuryakov,
 1895:  Asbj&oslash;rn Ulsberg,
 1896:  Boris Zbarsky,
 1897:  Bj&ouml;rn H&ouml;hrmann,
 1898:  Cameron McCormack,
 1899:  Christophe Jolif,
 1900:  Charles McCathieNevile,
 1901:  Dan Winship,
1.248 avankest 1902:  David Andersson,
1.159 avankest 1903:  David H&aring;s&auml;ther,
1.248 avankest 1904:  David Levin,
1.159 avankest 1905:  Dean Jackson,
 1906:  Denis Sureau,
 1907:  Doug Schepers,
 1908:  Douglas Livingstone,
 1909:  Elliotte Harold,
 1910:  Eric Lawrence,
1.196 avankest 1911:  Erik Dahlstr&ouml;m,
1.163 avankest 1912:  Geoffrey Sneddon,
1.159 avankest 1913:  Gideon Cohn,
 1914:  Gorm Haug Eriksen,
1.247 avankest 1915:  H&aring;kon Wium Lie,
1.159 avankest 1916:  Hallvord R. M. Steen,
1.247 avankest 1917:  Huub Schaeks,
1.159 avankest 1918:  Ian Davis,
 1919:  Ian Hickson,
 1920:  Ivan Herman,
 1921:  Jeff Walden,
 1922:  Jens Lindstr&ouml;m,
 1923:  Jim Deegan,
 1924:  Jim Ley,
 1925:  Joe Farro,
 1926:  Jonas Sicking,
 1927:  Julian Reschke,
 1928:  Karl Dubost,
1.175 avankest 1929:  Lachlan Hunt,
1.159 avankest 1930:  Maciej Stachowiak,
 1931:  Magnus Kristiansen,
 1932:  Marc Hadley,
 1933:  Marcos Caceres,
 1934:  Mark Baker,
1.203 avankest 1935:  Mark Birbeck,
1.159 avankest 1936:  Mark Nottingham,
1.267 avankest 1937:  Mark S. Miller,
1.248 avankest 1938:  Martin Hassman,
1.159 avankest 1939:  Mohamed Zergaoui,
1.256 avankest 1940:  Olli Pettay,
1.159 avankest 1941:  Pawel Glowacki,
1.231 avankest 1942:  Peter Michaux,
1.264 avankest 1943:  Philip Taylor,
1.159 avankest 1944:  Robin Berjon,
1.248 avankest 1945:  Rune Halvorsen,
1.159 avankest 1946:  Ruud Steltenpool,
 1947:  Simon Pieters,
 1948:  Stewart Brodie,
 1949:  Sunava Dutta,
1.186 avankest 1950:  Thomas Roessler,
1.203 avankest 1951:  Tom Magliery, and
1.159 avankest 1952:  Zhenbin Xu
1.181 avankest 1953: 
1.159 avankest 1954:  for their contributions to this specification.</p>
1.12 avankest 1955: 
1.1 avankest 1956:  <p>Special thanks to the Microsoft employees who first implemented the
1.143 avankest 1957:  <code title="">XMLHttpRequest</code> interface, which was first widely
 1958:  deployed by the Windows Internet Explorer browser.</p>
1.12 avankest 1959: 
1.143 avankest 1960:  <p>Special thanks also to the WHATWG for drafting an initial version of
 1961:  this specification in their Web Applications 1.0 document (now renamed to
1.250 avankest 1962:  HTML5). [<cite><span>HTML5</span></cite>]</p>
1.12 avankest 1963: 
1.143 avankest 1964:  <p>Thanks also to all those who have helped to improve this specification
 1965:  by sending suggestions and corrections. (Please, keep bugging us with your
1.22 avankest 1966:  issues!)</p>
1.1 avankest 1967: </body>
 1968: </html>
1.211 avankest 1969: 

Webmaster

AltStyle によって変換されたページ (->オリジナル) /