Annotation of 2006/webapi/XMLHttpRequest/Overview.src.html, revision 1.119
1.60 avankest 1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
1.1 avankest 2: <html lang="en-US">
 3: <head>
 4:  <title>The XMLHttpRequest Object</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.89 avankest 12:  .issue { padding:.5em; border:solid #f00 }
1.16 avankest 13:  p.issue::before { content:"Issue: " }
1.119 ! avankest 14:  dl.switch { padding-left:2em }
 ! 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 }
 21:  </style>
1.7 avankest 22:  <link rel="stylesheet" href="http://www.w3.org/StyleSheets/TR/base">
1.58 avankest 23:  <!--<link rel="stylesheet" href="http://www.w3.org/StyleSheets/TR/W3C-WD">-->
1.1 avankest 24: </head>
 25: <body>
 26:  <div class="head">
 27:  <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 28: 
1.10 avankest 29:  <h1 class="head">The <code title="">XMLHttpRequest</code> Object</h1>
1.12 avankest 30: 
1.53 avankest 31:  <h2 class="no-num no-toc" id="pagesubtitle">Editor's draft<!--W3C Working Draft--> [DATE: 3 August 2002]</h2>
1.12 avankest 32: 
1.1 avankest 33:  <dl>
1.10 avankest 34:   <dt>This Version:</dt>
1.24 avankest 35: 
1.47 avankest 36:   <dd><a href="[VERSION]/">http://www.w3.org/TR/[YEAR]/WD-XMLHttpRequest-[CDATE]/</a></dd>
1.14 avankest 37: 
1.10 avankest 38:   <dt>Latest Version:</dt>
1.24 avankest 39: 
1.1 avankest 40:   <dd><a href="http://www.w3.org/TR/XMLHttpRequest/">http://www.w3.org/TR/XMLHttpRequest/</a></dd>
1.14 avankest 41: 
1.10 avankest 42:   <dt>Previous Versions:</dt>
1.24 avankest 43: 
1.58 avankest 44:   <dd><a href="http://www.w3.org/TR/2007/WD-XMLHttpRequest-20070227/">http://www.w3.org/TR/2007/WD-XMLHttpRequest-20070227/</a></dd>
 45: 
1.22 avankest 46:   <dd><a href="http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060927/">http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060927/</a></dd>
1.24 avankest 47: 
1.1 avankest 48:   <dd><a href="http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060619/">http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060619/</a></dd>
1.24 avankest 49: 
1.1 avankest 50:   <dd><a href="http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060405/">http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060405/</a></dd>
1.14 avankest 51: 
1.1 avankest 52:   <dt>Editor:</dt>
1.24 avankest 53: 
1.1 avankest 54:   <dd><a href="http://annevankesteren.nl/">Anne van Kesteren</a>
 55:   (<a href="http://www.opera.com/">Opera Software ASA</a>)
 56:   <<a href="mailto:annevk@opera.com">annevk@opera.com</a>></dd>
 57:  </dl>
1.14 avankest 58: 
1.1 avankest 59:  <p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>
1.51 avankest 60:  © 2007
 61:  <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup>
 62:  (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
 63:  <a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
 64:  <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C
 65:  <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
 66:  <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
 67:  and
 68:  <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document
 69:  use</a> rules apply.</p>
1.1 avankest 70:  </div>
1.12 avankest 71: 
1.1 avankest 72:  <hr>
1.12 avankest 73: 
1.1 avankest 74:  <h2 class="no-num no-toc" id="specabstract">Abstract</h2>
1.10 avankest 75: 
1.22 avankest 76:  <p>The <code title="">XMLHttpRequest</code> Object specification defines an
 77:  <abbr title="Application Programming Interface">API</abbr> that provides
 78:  scripted client functionality for transferring data between a client and a
 79:  server.</p>
1.12 avankest 80: 
1.1 avankest 81:  <h2 class="no-num no-toc" id="sotd">Status of this Document</h2>
1.12 avankest 82: 
1.1 avankest 83:  <p><em>This section describes the status of this document at the time of its
1.36 avankest 84:  publication. Other documents may supersede this document. A list of current
 85:  W3C publications and the latest revision of this technical report can be
 86:  found in the <a href="http://www.w3.org/TR/">W3C technical reports index</a>
1.117 avankest 87:  at http://www.w3.org/TR/.</em></p>
1.36 avankest 88: 
1.63 avankest 89:  <!-- change back to Last Call -->
 90:  <p>This is the [DATE: 3 August 2002] <strong>Editor's</strong> Working
1.54 avankest 91:  Draft of The <code title="">XMLHttpRequest</code> Object specification.
1.47 avankest 92:  Please send comments to
 93:  <a href="mailto:public-webapi@w3.org">public-webapi@w3.org</a>
 94:  (<a href="http://lists.w3.org/Archives/Public/public-webapi/">archived</a>)
 95:  with either <samp>[XHR]</samp> or <samp title="">[XMLHttpRequest]</samp> at
1.63 avankest 96:  the start of the subject line<!-- by 2 April 2007-->.</p>
1.51 avankest 97: 
1.47 avankest 98:  <p>This document is produced by the
 99:  <a href="http://www.w3.org/2006/webapi/">Web API Working Group</a>, part of
 100:  the <a href="http://www.w3.org/2006/rwc/Activity">Rich Web Clients
 101:  Activity</a> in the W3C <a href="http://www.w3.org/Interaction/">Interaction
1.51 avankest 102:  Domain</a>. Changes made to this document can be found in the
1.47 avankest 103:  <a href="http://dev.w3.org/cvsweb/2006/webapi/XMLHttpRequest/Overview.html">W3C
1.117 avankest 104:  public CVS server</a>.</p>
1.12 avankest 105: 
1.1 avankest 106:  <p>Publication as a Working Draft does not imply endorsement by the W3C
1.36 avankest 107:  Membership. This is a draft document and may be updated, replaced or
 108:  obsoleted by other documents at any time. It is inappropriate to cite this
 109:  document as other than work in progress.</p>
1.12 avankest 110: 
1.1 avankest 111:  <p>This document was produced by a group operating under the
1.36 avankest 112:  <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February
1.52 avankest 113:  2004 W3C Patent Policy</a>. W3C maintains a
1.36 avankest 114:  <a rel="disclosure" href="http://www.w3.org/2004/01/pp-impl/38482/status">public
 115:  list of any patent disclosures</a> made in connection with the deliverables
 116:  of the group; that page also includes instructions for disclosing a patent.
 117:  An individual who has actual knowledge of a patent which the individual
 118:  believes contains
 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.1 avankest 124:  <h2 class="no-num no-toc" id="toc">Table of Contents</h2>
1.21 avankest 125: 
1.1 avankest 126:  <!--toc-->
1.12 avankest 127: 
1.1 avankest 128:  <h2 id="introduction">Introduction</h2>
1.12 avankest 129: 
1.1 avankest 130:  <p><em>This section is non-normative.</em></p>
1.12 avankest 131: 
1.33 avankest 132:  <p>The <code>XMLHttpRequest</code> object implements an interface exposed by
 133:  a scripting engine that allows scripts to perform HTTP client functionality,
1.22 avankest 134:  such as submitting form data or loading data from a server.</p>
1.24 avankest 135: 
1.1 avankest 136:  <p>The name of the object is <code>XMLHttpRequest</code> for compatibility
1.22 avankest 137:  with the web, though each component of this name is potentially misleading.
1.39 avankest 138:  First, the object supports any text based format, including XML. Second, it
 139:  can be used to make requests over both HTTP and HTTPS (some implementations
 140:  support protocols in addition to HTTP and HTTPS, but that functionality is
 141:  not covered by this specification). Finally, it supports "requests" in a
 142:  broad sense of the term as it pertains to HTTP; namely all activity involved
 143:  with HTTP requests or responses for the defined HTTP methods.</p>
1.12 avankest 144: 
1.1 avankest 145:  <h3 id="examples">Examples of Usage</h3>
1.12 avankest 146: 
1.1 avankest 147:  <p><em>This section is non-normative.</em></p>
1.12 avankest 148: 
1.37 avankest 149:  <p>Some [<cite><span>ECMAScript</span></cite>] examples
1.32 avankest 150:  are listed in the specification. In addition, you can find some below.</p>
1.14 avankest 151: 
 152:  <div class="example">
 153:  <p>Some simple code to do something with data from an XML document fetched
1.22 avankest 154:  over the network:</p>
1.16 avankest 155: 
1.58 avankest 156:  <pre><code>function test(data) {
1.14 avankest 157: // taking care of data
 158: }
 159: 
 160: function handler() {
1.117 avankest 161: if(this.readyState == 4 && this.status == 200) {
1.14 avankest 162:  // so far so good
1.117 avankest 163:  if(this.responseXML != null && this.responseXML.getElementById('test').firstChild.data)
 164:   // success!
1.14 avankest 165:  test(this.responseXML.getElementById('test').firstChild.data);
 166:  else
 167:  test(null);
1.117 avankest 168: } else if (this.readyState == 4 && this.status != 200) {
1.14 avankest 169:  // fetched the wrong page or network error...
 170:  test(null);
 171: }
 172: }
1.12 avankest 173: 
1.14 avankest 174: var client = new XMLHttpRequest();
 175: client.onreadystatechange = handler;
 176: client.open("GET", "test.xml");
1.58 avankest 177: client.send();</code></pre>
1.16 avankest 178: 
1.56 avankest 179:  <p>If you just want to log a message to the server:</p>
1.16 avankest 180: 
1.58 avankest 181:  <pre><code>function log(message) {
1.14 avankest 182: var client = new XMLHttpRequest();
1.56 avankest 183: client.open("POST", "/log");
1.57 avankest 184: client.setRequestHeader("Content-Type", "text/plain;charset=UTF-8");
1.14 avankest 185: client.send(message);
1.58 avankest 186: }</code></pre>
1.16 avankest 187: 
1.14 avankest 188:  <p>Or if you want to check the status of a document on the server:</p>
1.16 avankest 189: 
1.58 avankest 190:  <pre><code>function fetchStatus(address) {
1.14 avankest 191: var client = new XMLHttpRequest();
 192: client.onreadystatechange = function() {
 193:  // in case of network errors this might not give reliable results
 194:  if(this.readyState == 4)
 195:  returnStatus(this.status);
 196: }
 197: client.open("HEAD", address);
 198: client.send();
1.58 avankest 199: }</code></pre>
1.14 avankest 200:  </div>
1.12 avankest 201: 
1.1 avankest 202:  <h3 id="conformance">Conformance</h3>
1.12 avankest 203: 
1.27 avankest 204:  <p>Everything in this specification is normative except for diagrams,
 205:  examples, notes and sections marked non-normative.</p>
1.12 avankest 206: 
1.1 avankest 207:  <p>The key words <em class="ct">must</em>, <em class="ct">must not</em>,
1.74 avankest 208:  <em class="ct">should</em> and <em class="ct">may</em> in this document are
 209:  to be interpreted as described in RFC 2119.
 210:  [<cite><span>RFC2119</span></cite>]</p>
1.12 avankest 211: 
1.1 avankest 212:  <p>This specification defines the following classes of products:</p>
1.12 avankest 213: 
1.1 avankest 214:  <dl>
1.74 avankest 215:  <dt><dfn id="conforming-user-agent">Conforming user agent</dfn></dt>
1.24 avankest 216: 
1.74 avankest 217:  <dd>
 218:   <p>A user agent <em class="ct">must</em> behave as described in this
1.106 avankest 219:   specification in order to be considered conformant.</p>
1.95 avankest 220: 
1.94 avankest 221:   <p>If the user agent does not support XML (including support for
 222:   namespaces) the <span>XML response entity body</span>
 223:   <em class="ct">must</em> (always) be <code>null</code>.</p>
1.74 avankest 224: 
1.75 avankest 225:   <p>User agents <em class="ct">may</em> optimize any algorithm given in
 226:   this specification, so long as the end result is indistinguishable from
 227:   the result that would be obtained by the specification's algorithms. (The
 228:   algorithms in this specification are generally written with more concern
 229:   for clarity than efficiency.)</p>
1.110 avankest 230: 
1.95 avankest 231:   <p class="note">This specification uses both the terms "conforming user
 232:   agent(s)" and "user agent(s)" to refer to this product class.</p>
1.74 avankest 233:  </dd>
1.110 avankest 234: 
1.94 avankest 235:  <dt><dfn id="conforming-xml-user-agent">Conforming XML user agent</dfn></dt>
1.110 avankest 236: 
1.94 avankest 237:  <dd><p>A user agent that is a <span>conforming user agent</span> and also
 238:  supports XML (including support for namespaces).</p></dd>
1.1 avankest 239:  </dl>
1.32 avankest 240: 
1.30 avankest 241:  <h4 id="dependencies">Dependencies</h4>
1.33 avankest 242: 
1.29 avankest 243:  <p>This specification relies on several underlying specifications.</p>
 244:  <dl>
 245:  <dt>DOM</dt>
1.33 avankest 246: 
1.29 avankest 247:  <dd>
1.95 avankest 248:   <p><span title="Conforming user agent">Conforming user agents</span>
 249:   <em class="ct">must</em> support some version of DOM Events and DOM Core,
 250:   because this specification uses some of the features defined in those
 251:   specifications. [<cite><span>DOM3Events</span></cite>]
 252:   [<cite><span>DOM3Core</span></cite>]</p>
 253: 
 254:   <p>It <em class="ct">must</em> also support some version of the Window
 255:   Object because some of the functionality in this specification relies on
 256:   it. [<cite><span>Window</span></cite>]</p>
1.29 avankest 257:  </dd>
 258: 
 259:  <dt>HTTP</dt>
1.33 avankest 260: 
1.29 avankest 261:  <dd>
1.95 avankest 262:   <p><span title="Conforming user agent">Conforming user agents</span>
 263:   <em class="ct">must</em> support some version of the HTTP protocol. The
 264:   user agent <em class="ct">should</em> support any HTTP method that matches
 265:   the <span><code>Method</code> production</span> and
 266:   <em class="ct">must</em> at least support the following methods:</p>
1.58 avankest 267: 
 268:   <ul>
 269:   <li><code>GET</code></li>
 270:   <li><code>POST</code></li>
 271:   <li><code>HEAD</code></li>
 272:   <li><code>PUT</code></li>
 273:   <li><code>DELETE</code></li>
 274:   <li><code>OPTIONS</code></li>
 275:   </ul>
 276: 
 277:   <p>Other requirements regarding HTTP are made throughout the
1.39 avankest 278:   specification. [<cite><span>RFC2616</span></cite>]</p>
1.29 avankest 279:  </dd>
1.41 avankest 280: 
 281:  <dt>XML</dt>
 282: 
1.95 avankest 283:  <dd><p><span title="Conforming XML user agent">Conforming XML user
 284:  agents</span> <em class="ct">must</em> support XML (including support for
 285:  namespaces). [<cite><span>XML</span></cite>]
 286:  [<cite><span>XMLNS</span></cite>]</p></dd>
1.29 avankest 287:  </dl>
1.12 avankest 288: 
1.80 avankest 289:  <h4 id="terminology">Terminology</h4>
1.12 avankest 290: 
1.80 avankest 291:  <p>There is a <dfn id="case-insensitive-match">case-insensitive match</dfn>
1.101 avankest 292:  of strings <var>s1</var> and <var>s2</var> if after uppercasing both strings
1.100 avankest 293:  (by mapping a-z to A-Z) they are identical.</p>
1.80 avankest 294: 
 295:  <h4 id="extensibility">Extensibility</h4>
1.12 avankest 296: 
1.81 avankest 297:  <p>Extensions of the API defined by this specification are <em>strongly
1.22 avankest 298:  discouraged</em>. User agents, Working Groups and other interested parties
1.33 avankest 299:  should discuss extensions on a relevant public forum, preferably
1.22 avankest 300:  <a href="mailto:public-webapi@w3.org">public-webapi@w3.org</a>.</p>
1.12 avankest 301: 
 302:  <h2 id="xmlhttprequest">The <code title="">XMLHttpRequest</code> Object</h2>
 303: 
1.58 avankest 304:  <p>The <code>XMLHttpRequest</code> object can be used by scripts to
1.22 avankest 305:  programmatically connect to their originating server via HTTP.</p>
1.12 avankest 306: 
1.1 avankest 307:  <p>Objects implementing the <code>XMLHttpRequest</code> interface
1.22 avankest 308:  <em class="ct">must</em> also implement the <code>EventTarget</code>
1.58 avankest 309:  interface. [<cite><span>DOM3Events</span></cite>]</p>
1.12 avankest 310: 
1.58 avankest 311:  <p>Objects implementing the <code title="">Window</code> interface
 312:  <em class="ct">must</em> provide an <code title="">XMLHttpRequest()</code>
 313:  constructor. [<cite><span>Window</span></cite>]</p>
1.12 avankest 314: 
1.1 avankest 315:  <div class="example">
1.58 avankest 316:  <p>In ECMAScript this can be used as follows:</p>
 317: 
 318:  <pre><code>var client = new XMLHttpRequest();</code></pre>
1.1 avankest 319:  </div>
1.12 avankest 320: 
1.58 avankest 321:  <p>When the <code title="">XMLHttpRequest()</code> constructor is invoked a
 322:  persistent pointer to the associated <code title="">Window</code> object
 323:  <em class="ct">must</em> be stored on the newly created object. This is the
1.25 avankest 324:  <dfn title="Window pointer" id="window-pointer"><code>Window</code>
1.58 avankest 325:  pointer</dfn>. The associated <code title="">Window</code> object is the one
 326:  of which the <code title="">XMLHttpRequest</code> constructor was
 327:  invoked. This <span title="Window pointer">pointer</span>
1.25 avankest 328:  <em class="ct">must</em> persist even if the browsing context in which the
1.37 avankest 329:  <code title="">Window</code> is located is destroyed (by removing it from a
 330:  parent browsing context, for instance).</p>
1.25 avankest 331: 
1.37 avankest 332:  <p>The term browsing context is defined by the <cite>Window Object
 333:  1.0</cite> specification. [<cite><span>Window</span></cite>]</p>
1.27 avankest 334: 
 335:  <!-- XXX if the document object changes in the browsing context you get an
1.33 avankest 336:  exception in some implementations. -->
1.27 avankest 337: 
1.58 avankest 338:  <div class="example">
1.65 avankest 339:  <p>If <var><code>win</code></var> is a <code title="">Window</code> object
 340:  <var><code>client</code></var> will have a pointer to
 341:  <var><code>win</code></var> in the following example:</p>
1.58 avankest 342: 
1.65 avankest 343:  <pre><code>var client = new win.XMLHttpRequest()</code></pre>
1.58 avankest 344:  </div>
1.12 avankest 345: 
1.58 avankest 346:  <pre class="idl">interface <dfn id="xmlhttprequest-object">XMLHttpRequest</dfn> {
 347:  // event handler
1.70 avankest 348:      attribute EventListener <span>onreadystatechange</span>;
1.58 avankest 349: 
 350:  // state
1.71 avankest 351:  const unsigned short <span title="UNSENT state">UNSENT</span> = 0;
1.58 avankest 352:  const unsigned short <span title="OPEN state">OPEN</span> = 1;
 353:  const unsigned short <span title="SENT state">SENT</span> = 2;
1.86 avankest 354:  const unsigned short <span title="LOADING state">LOADING</span> = 3;
1.117 avankest 355:  const unsigned short <span title="DONE state">DONE</span> = 4;
1.70 avankest 356:  readonly attribute unsigned short <span>readyState</span>;
1.58 avankest 357: 
 358:  // request
1.70 avankest 359:  void <span>open</span>(in DOMString <var>method</var>, in DOMString <var>url</var>);
 360:  void <span>open</span>(in DOMString <var>method</var>, in DOMString <var>url</var>, in boolean <var>async</var>);
 361:  void <span>open</span>(in DOMString <var>method</var>, in DOMString <var>url</var>, in boolean <var>async</var>, in DOMString <var>user</var>);
 362:  void <span>open</span>(in DOMString <var>method</var>, in DOMString <var>url</var>, in boolean <var>async</var>, in DOMString <var>user</var>, in DOMString <var>password</var>);
 363:  void <span>setRequestHeader</span>(in DOMString <var>header</var>, in DOMString <var>value</var>);
 364:  void <span>send</span>();
 365:  void <span>send</span>(in DOMString <var>data</var>);
 366:  void <span>send</span>(in Document <var>data</var>);
 367:  void <span>abort</span>();
1.58 avankest 368: 
 369:  // response
1.70 avankest 370:  DOMString <span>getAllResponseHeaders</span>();
 371:  DOMString <span>getResponseHeader</span>(in DOMString <var>header</var>);
 372:  readonly attribute DOMString <span>responseText</span>;
 373:  readonly attribute Document <span>responseXML</span>;
 374:  readonly attribute unsigned short <span>status</span>;
 375:  readonly attribute DOMString <span>statusText</span>;
1.1 avankest 376: };</pre>
1.8 avankest 377: 
1.58 avankest 378:  <p>The <code>XMLHttpRequest</code> object can be in five states:
1.71 avankest 379:  <span title="UNSENT state">UNSENT</span>,
1.58 avankest 380:  <span title="OPEN state">OPEN</span>, <span title="SENT state">SENT</span>,
1.86 avankest 381:  <span title="LOADING state">LOADING</span> and
1.79 avankest 382:  <span title="DONE state">DONE</span>. The current state is exposed through
 383:  the <code>readyState</code> attribute. The method definitions below define
 384:  when a state transition takes place.</p>
1.58 avankest 385: 
 386:  <p>When constructed, the <code>XMLHttpRequest</code> object
1.71 avankest 387:  <em class="ct">must</em> be in the UNSENT state. This state is represented
 388:  by the <dfn id="unsent" title="UNSENT state"><code>UNSENT</code></dfn>
1.58 avankest 389:  constant, whose value is <code>0</code>.</p>
 390: 
 391:  <p>The OPEN state is the state of the object when the <code>open()</code>
1.92 avankest 392:  method has been successfully invoked. During this state request headers can
1.58 avankest 393:  be set using <code>setRequestHeader()</code> and the request can be made
 394:  using <code>send()</code>. This state is represented by the
 395:  <dfn id="open" title="OPEN state"><code>OPEN</code></dfn> constant, whose
 396:  value is <code>1</code>.</p>
 397: 
1.87 avankest 398:  <p>During the OPEN state there is a <dfn id="send-flag"><code>send()</code>
1.104 avankest 399:  flag</dfn> which can be either "true" or "false". The initial value of the
 400:  <code title="">send()</code> flag is "false".</p>
1.87 avankest 401: 
1.58 avankest 402:  <p>The SENT state is the state of the object when the user agent
 403:  successfully acknowledged the request. This state is represented by the
 404:  <dfn id="sent" title="SENT state"><code>SENT</code></dfn> constant, whose
 405:  value is <code>2</code>.</p>
 406: 
1.86 avankest 407:  <p>The LOADING state is the state of the object when all HTTP headers have
1.58 avankest 408:  been received. The object typically remains in this state until the complete
 409:  message body (if any) has been received. This state is represented by the
1.86 avankest 410:  <dfn id="loading" title="LOADING state"><code>LOADING</code></dfn> constant,
 411:  whose value is <code>3</code>.</p>
1.58 avankest 412: 
1.79 avankest 413:  <p>The DONE state is the state of the object when either the data transfer
1.58 avankest 414:  has been completed or something went wrong during the transfer (infinite
 415:  redirects for instance). This state is represented by the
1.79 avankest 416:  <dfn id="done" title="DONE state"><code>DONE</code></dfn> constant, whose
 417:  value is <code>4</code>.</p>
1.90 avankest 418: 
1.88 avankest 419:  <p>The <dfn id="response-entity-body">response entity body</dfn> is the
 420:  fragment of the <span>entity body</span> received so far (LOADING state) or
 421:  the complete entity body (DONE state). If there is no entity body the
 422:  response entity body is "null".</p>
 423: 
 424:  <p>The <dfn id="text-response-entity-body">text response entity body</dfn>
1.107 avankest 425:  is either a <code>DOMString</code> representing the <span>response entity
 426:  body</span> or <code>null</code>. The value of the text response entity body
 427:  <em class="ct">must</em> be determined by running the following
 428:  algorithm:</p>
1.90 avankest 429: 
1.88 avankest 430:  <ol>
1.107 avankest 431:  <li><p>If the response entity body is "null" return <code>null</code> and
 432:  terminate these steps.</p>
1.90 avankest 433: 
1.113 avankest 434:  <li><p>Let <var>charset</var> be "null".</p></li>
1.90 avankest 435: 
 436:  <li><p>If there is no <code>Content-Type</code> header or there is a
 437:  <code>Content-Type</code> header which contains a MIME type that is
1.116 avankest 438:  <code>text/xml</code>, <code>application/xml</code> or ends in
 439:  <code title="">+xml</code> (ignoring any parameters) use the rules set forth
 440:  in the XML specification to determine the character encoding. Let
 441:  <var>charset</var> be the determined character encoding.</p></li>
1.90 avankest 442: 
1.118 avankest 443:  <li><p>If there is a <code>Content-Type</code> header contains a
 444:  <code>text/html</code> MIME type follow the rules set forth in the HTML
 445:  specification to determine the character encoding. Let <var>charset</var> be
 446:  the determined character encoding.</p></li>
 447:  <!-- XXX ref -->
 448: 
1.115 avankest 449:  <li>
 450:   <p>If the <code>Content-Type</code> MIME type contains a
 451:   <code>charset</code> parameter and <var>charset</var> is "null" let
 452:   <var>charset</var> be the value of that parameter.</p>
1.118 avankest 453: 
 454:   <p class="note">The algorithms described by the XML and HTML specifications
 455:   already take <code>Content-Type</code> into account.</p>
1.115 avankest 456:  </li>
1.118 avankest 457: 
1.111 avankest 458:  <li>
 459:   <!-- This stuff is copied from HTML5. Thanks Hixie! -->
1.113 avankest 460:   <p>If <var>charset</var> is "null" then, for each of the rows in the
 461:   following table, starting with the first one and going down, if the start
 462:   of the entity body (<var>bytes</var>) is equal to or greater than the
 463:   number of bytes in the first column, and the first bytes of
 464:   <var>bytes</var> match the bytes given in the first column, then let
 465:   <var>charset</var> be the encoding given in the cell in the second column
 466:   of that row. When an encoding is determined or when no encoding is
1.117 avankest 467:   determined go to the next step:</p>
 468: 
 469:   <table>
 470:   <thead>
 471:    <tr>
1.111 avankest 472:    <th>Bytes in Hexadecimal
 473:    <th>Description
1.117 avankest 474:   <tbody>
 475:    <tr>
1.111 avankest 476:    <td>00 00 FE FF
1.117 avankest 477:    <td>UTF-32BE BOM
 478:    <tr>
 479:    <td>FF FE 00 00
 480:    <td>UTF-32LE BOM
 481:    <tr>
 482:    <td>FE FF
 483:    <td>UTF-16BE BOM
 484:    <tr>
 485:    <td>FF FE
 486:    <td>UTF-16LE BOM
 487:    <tr>
 488:    <td>EF BB BF
 489:    <td>UTF-8 BOM<!-- nobody uses this
 490:    <tr>
 491:    <td>DD 73 66 73
 492:    <td>UTF-EBCDIC
 493: -->
 494:   </table>
1.111 avankest 495:  </li>
 496: 
1.113 avankest 497:  <li><p>If <var>charset</var> is "null" let <var>charset</var> be
 498:  UTF-8.</p></li>
 499: 
1.107 avankest 500:  <li><p>Return the result of decoding the response entity body using
 501:  <var>charset</var>. Or, if that fails, return <code>null</code>.</p></li>
1.88 avankest 502:  </ol>
1.90 avankest 503: 
1.88 avankest 504:  <p>The <dfn id="xml-response-entity-body">XML response entity body</dfn> is
1.107 avankest 505:  either a <code>Document</code> representing the <span>response entity
 506:  body</span> or <code>null</code> and is determined by running the following
 507:  algorithm (the return value is its value):</p>
1.90 avankest 508: 
1.88 avankest 509:  <ol>
1.107 avankest 510:  <li><p>If the response entity body is "null" terminate these steps and
 511:  return <code>null</code>.</p></li>
1.88 avankest 512: 
1.103 avankest 513:  <li><p>If a <code>Content-Type</code> is present and it does not contain a
 514:  MIME type (ignoring any parameters) that is <code>text/xml</code>,
1.116 avankest 515:  <code>application/xml</code> or ends in <code title="">+xml</code> terminate
 516:  these steps and return <code>null</code>. (Do not terminate these steps if
 517:  there is no <code>Content-Type</code> header at all.)</p></li>
1.88 avankest 518: 
1.107 avankest 519:  <li><p>Parse the response entity body following the rules from the XML
 520:  specifications. Let the result be <var>parsed document</var>. If this fails
 521:  (unsupported character encoding, namespace well-formedness error et cetera)
 522:  terminate these steps return <code>null</code>.
1.96 avankest 523:  [<cite><span>XML</span></cite>] [<cite><span>XMLNS</span></cite>]</p></li>
1.88 avankest 524: 
1.96 avankest 525:  <li><p>Return an object implementing the <code>Document</code>
1.88 avankest 526:  interface representing the <var>parsed document</var>.</p></li>
 527:  </ol>
1.58 avankest 528: 
1.5 avankest 529:  <dl>
1.39 avankest 530:  <dt><dfn id="dfn-onreadystatechange"><code>onreadystatechange</code></dfn>
 531:  of type <code>EventListener</code></dt>
1.12 avankest 532: 
1.1 avankest 533:  <dd>
 534:   <p>An attribute that takes an <code>EventListener</code> as value that
1.58 avankest 535:   <em class="ct">must</em> be invoked along with any other appropriate event
 536:   listeners that are registered on this object when a
1.87 avankest 537:   <code>readystatechange</code> event is dispatched on it during the
 538:   bubbling phase. Its initial value <em class="ct">must</em> be
 539:   <code>null</code>.</p>
1.1 avankest 540:  </dd>
1.12 avankest 541: 
1.1 avankest 542:  <dt><dfn id="dfn-readystate"><code>readyState</code></dfn> of type
1.22 avankest 543:  <code>unsigned short</code>, readonly</dt>
1.12 avankest 544: 
1.1 avankest 545:  <dd>
1.58 avankest 546:   <p>The attribute <em class="ct">must</em> be the value of the constant
 547:   corresponding to the object's current state.</p>
1.1 avankest 548:  </dd>
1.12 avankest 549: 
1.14 avankest 550:  <dt><dfn id="dfn-open" title="open"><code>open(<var>method</var>,
1.22 avankest 551:  <var>url</var>, <var>async</var>, <var>user</var>,
 552:  <var>password</var>)</code></dfn>, method</dt>
1.12 avankest 553: 
1.1 avankest 554:  <dd>
1.58 avankest 555:   <p>When invoked, the user agent <em class="ct">must</em> follow the
1.96 avankest 556:   following steps (unless otherwise indicated):</p>
1.58 avankest 557: 
 558:   <ol>
1.97 avankest 559:   <li><p>If the <var>method</var> argument does not match the
1.58 avankest 560:   <dfn><code>Method</code> production</dfn> defined in section 5.1.1 of RFC
1.98 avankest 561:   2616 raise a <code>SYNTAX_ERR</code> exception and terminate these steps.
1.58 avankest 562:   [<cite><span>RFC2616</span></cite>]</p></li>
 563: 
 564:   <li><p>If the given <var>method</var> is not supported for security
 565:   reasons the user agent <em class="ct">should</em> raise a
1.98 avankest 566:   <code>SECURITY_ERR</code> exception and terminate these steps.</p></li>
1.58 avankest 567: 
 568:   <li><p>Let <var>stored method</var> be <var>method</var>.</p></li>
 569: 
1.80 avankest 570:   <li><p>If <var>method</var>
 571:   <span title="case-insensitive match">case-insensitively matches</span>
 572:   <code>GET</code>, <code>POST</code>, <code>HEAD</code>, <code>PUT</code>,
1.96 avankest 573:   <code>DELETE</code> or <code>OPTIONS</code> convert it to its uppercase
 574:   equivalent (by mapping a-z to A-Z) and let <var>stored method</var> be
 575:   the result.</p></li>
1.68 avankest 576:   <!-- WebKit (and supposedly Firefox) also uppercase: CONNECT, COPY,
 577:   INDEX, LOCK, M-POST, MKCOL, MOVE, PROPFIND, PROPPATCH, TRACE and UNLOCK.
 578:   Not sure if TRACE and CONNECT are worth it though. They raise a
 579:   SECURITY_ERR exception anyway... -->
1.58 avankest 580: 
 581:   <li><p>Drop the fragment identifier (if any) from <var>url</var> and let
 582:   <var>stored url</var> be the result of that operation.</p></li>
 583: 
1.96 avankest 584:   <li><p>If <var>stored url</var> is a relative reference resolve it using
 585:   the current value of the <code>baseURI</code> attribute of the
 586:   <code>Document</code> object currently associated with the
 587:   <span><code>Window</code> pointer</span>. If this fails raise a
1.98 avankest 588:   <code>SYNTAX_ERR</code> exception and terminate these steps.</p></li>
1.58 avankest 589: 
1.101 avankest 590:   <li><p>If <var>stored url</var> contains an unsupported scheme raise a
 591:   <code>NOT_SUPPORTED_ERR</code> and terminate these steps.</p></li>
1.110 avankest 592: 
1.58 avankest 593:   <li><p>If the <code>"user:password"</code> format in the
 594:   <code>userinfo</code> production defined in section 3.2.1 of RFC 3986 is
 595:   not supported for the relevant scheme and <var>stored url</var> contains
1.98 avankest 596:   this format raise a <code>SYNTAX_ERR</code> and terminate these steps.
1.69 avankest 597:   [<cite><span>RFC3986</span></cite>]</p></li>
1.58 avankest 598: 
 599:   <li><p>If <var>stored url</var> contains the <code>"user:password"</code>
 600:   format let <var>stored user</var> be the user part and <var>stored
 601:   password</var> be the password part.</p></li>
 602: 
 603:   <li><p>If <var>stored url</var> just contains the <code>"user"</code>
 604:   format let <var>stored user</var> be the user part.</p></li>
 605: 
1.69 avankest 606:   <li>
 607:    <p>If <var>stored url</var> is non same-origin the user agent
 608:    <em class="ct">should</em> raise a <code>SECURITY_ERR</code> exception
1.98 avankest 609:    and terminate these steps.</p>
1.69 avankest 610:    <p class="note">This specification does not define what constitutes as
1.117 avankest 611:    non same-origin. It is expected that what constitutes as non same-origin
1.102 avankest 612:    will be defined before this specification eventually reaches the W3C
 613:    Recommendation status by way of referencing a specification that defines
 614:    it.<!-- XXX reference HTML5? --></p>
1.69 avankest 615:   </li>
1.58 avankest 616: 
 617:   <li><p>Let <var>async</var> be the value of the <var>async</var> argument
1.102 avankest 618:   or <code>true</code> if it was omitted.</p></li>
1.58 avankest 619: 
 620:   <li><p>If the <var>user</var> argument was not omitted and its syntax
1.96 avankest 621:   does not match that specified by the relevant authentication scheme raise
1.98 avankest 622:   a <code>SYNTAX_ERR</code> exception and terminate these steps.</p></li>
1.14 avankest 623: 
1.58 avankest 624:   <li>
 625:    <p>If the <var>user</var> argument was not omitted and is not
 626:    <code>null</code> let <var>stored user</var> be <var>user</var> encoded
 627:    using the encoding specified in the relevant authentication scheme or
 628:    UTF-8 if the scheme fails to specify an encoding.</p>
1.14 avankest 629: 
1.58 avankest 630:    <p class="note">This step overrides any user that may have been set by
 631:    the <var>url</var> argument.</p>
 632:   </li>
1.16 avankest 633: 
1.58 avankest 634:   <li><p>If the <var>user</var> argument was not omitted and is
 635:   <code>null</code> remove <var>stored user</var>.</p></li>
1.14 avankest 636: 
1.58 avankest 637:   <li><p>If the <var>password</var> argument was not omitted and its syntax
1.96 avankest 638:   does not match that specified by the relevant authentication scheme raise
1.98 avankest 639:   a <code>SYNTAX_ERR</code> exception and terminate these steps.</p></li>
1.58 avankest 640: 
 641:   <li><p>If the <var>password</var> argument was not omitted and is not
 642:   <code>null</code> let <var>stored password</var> be <var>password</var>
 643:   encoded using the encoding specified in the relevant authentication
 644:   scheme or UTF-8 if the scheme fails to specify an encoding.</p></li>
 645: 
 646:   <li><p>If the <var>password</var> argument was not omitted and is
 647:   <code>null</code> remove <var>stored password</var>.</p></li>
 648: 
1.108 avankest 649:   <li><p><span title="abort send()">Abort the <code>send()</code>
 650:   algorithm</span>, set <span>response entity body</span> to "null" and
 651:   reset the list of request headers.<p></li>
1.58 avankest 652: 
1.108 avankest 653:   <li><p>The user agent <em class="ct">should</em> cancel any network
 654:   activity for which the object is responsible.</p></li>
1.58 avankest 655:   <!-- we can hardly require it... -->
 656: 
 657:   <li><p>Switch the object to the <span title="OPEN state">OPEN</span>
1.105 avankest 658:   state, set the <span><code>send()</code> flag</span> to "false" and then
1.104 avankest 659:   synchronously dispatch a <code>readystatechange</code> event on the
 660:   object and return the method call.</p></li>
1.58 avankest 661:   </ol>
1.14 avankest 662: 
1.19 avankest 663:   <p class="note">A future version or extension of this specification will
1.33 avankest 664:   most likely define a way of doing cross-site requests.</p>
1.1 avankest 665:  </dd>
1.12 avankest 666: 
1.14 avankest 667:  <dt><dfn id="dfn-setrequestheader" title="setrequestheader"><code>setRequestHeader(<var>header</var>,
1.22 avankest 668:  <var>value</var>)</code></dfn>, method</dt>
1.12 avankest 669: 
1.5 avankest 670:  <dd>
1.45 avankest 671:   <p>Each request has a list of request headers with associated values. This
 672:   method can be used to manipulate those values and set new request
 673:   headers.</p>
 674: 
1.58 avankest 675:   <p>When invoked, the user agent <em class="ct">must</em> follow the
1.96 avankest 676:   following steps (unless otherwise indicated):</p>
1.14 avankest 677: 
1.58 avankest 678:   <ol>
 679:   <li><p>If the state of the object is not
1.96 avankest 680:   <span title="OPEN state">OPEN</span> raise an
1.98 avankest 681:   <code>INVALID_STATE_ERR</code> exception and terminate these
 682:   steps.</p></li>
1.96 avankest 683: 
 684:   <li><p>If the <span><code>send()</code> flag</span> is "true" raise an
1.98 avankest 685:   <code>INVALID_STATE_ERR</code> exception and terminate these
 686:   steps.</p></li>
1.14 avankest 687: 
1.97 avankest 688:   <li><p>If the <var>header</var> argument does not match the
1.22 avankest 689:   <dfn><code>field-name</code> production</dfn> as defined by section 4.2
1.96 avankest 690:   of RFC 2616 or is <code>null</code> raise a <code>SYNTAX_ERR</code>
1.98 avankest 691:   exception and terminate these steps.
1.96 avankest 692:   [<cite><span>RFC2616</span></cite>]</p></li>
 693: 
1.98 avankest 694:   <li><p>If the <var>value</var> argument is <code>null</code> terminate
 695:   these steps. (Do not raise an exception.)</li>
1.70 avankest 696:   <!-- undefined is to be treated as null here... -->
1.79 avankest 697: 
1.97 avankest 698:   <li><p>If the <var>value</var> argument does not match the
1.22 avankest 699:   <dfn><code>field-value</code> production</dfn> as defined by section 4.2
1.98 avankest 700:   of RFC 2616 raise a <code>SYNTAX_ERR</code> and terminate these steps.
1.58 avankest 701:   [<cite><span>RFC2616</span></cite>]</p></li>
1.14 avankest 702: 
1.32 avankest 703:   <li>
1.58 avankest 704:    <p>For security reasons these steps <em class="ct">should</em> be
1.98 avankest 705:    terminated if the <var>header</var> argument
1.80 avankest 706:    <span title="case-insensitive match">case-insensitively matches</span>
 707:    one of the following headers:</p>
1.58 avankest 708: 
1.32 avankest 709:    <ul>
 710:    <li><code>Accept-Charset</code></li>
 711:    <li><code>Accept-Encoding</code></li>
1.68 avankest 712:    <li><code>Connection</code></li>
1.32 avankest 713:    <li><code>Content-Length</code></li>
1.68 avankest 714:    <li><code>Content-Transfer-Encoding</code></li>
 715:    <li><code>Date</code></li>
1.32 avankest 716:    <li><code>Expect</code></li>
 717:    <li><code>Host</code></li>
 718:    <li><code>Keep-Alive</code></li>
 719:    <li><code>Referer</code></li>
 720:    <li><code>TE</code></li>
 721:    <li><code>Trailer</code></li>
 722:    <li><code>Transfer-Encoding</code></li>
 723:    <li><code>Upgrade</code></li>
1.68 avankest 724:    <li><code>Via</code></li>
1.32 avankest 725:    </ul>
 726:   </li>
1.5 avankest 727: 
1.58 avankest 728:   <li><p>If the <var>header</var> argument is not in the list of request
1.96 avankest 729:   headers append the <var>header</var> with its associated <var>value</var>
1.98 avankest 730:   to the list and terminate these steps.</p></li>
1.58 avankest 731: 
 732:   <li><p>If the <var>header</var> argument is in the list of request
1.96 avankest 733:   headers either use multiple headers, combine the values or use a
 734:   combination of those (section 4.2, RFC 2616).
 735:   [<cite><span>RFC2616</span></cite>]</p></li>
 736:   <!-- XXX it seems UAs always combine the values -->
1.58 avankest 737:   </ol>
1.45 avankest 738: 
 739:   <p class="note">See also the <code>send()</code> method regarding user
1.71 avankest 740:   agent header handling for caching, authentication, proxies, and
 741:   cookies.</p>
1.14 avankest 742: 
 743:   <div class="example">
1.58 avankest 744:   <pre><code>// The following script:
1.14 avankest 745: var client = new XMLHttpRequest();
 746: client.open('GET', 'demo.cgi');
 747: client.setRequestHeader('X-Test', 'one');
 748: client.setRequestHeader('X-Test', 'two');
 749: client.send();
 750: 
 751: // ...would result in the following header being sent:
 752: ...
 753: X-Test: one, two
1.58 avankest 754: ...</code></pre>
1.14 avankest 755:   </div>
1.5 avankest 756:  </dd>
1.12 avankest 757: 
1.14 avankest 758:  <dt><dfn id="dfn-send" title="send"><code>send(<var>data</var>)</code></dfn>,
1.22 avankest 759:  method</dt>
1.12 avankest 760: 
1.17 avankest 761:  <dd>
1.58 avankest 762:   <p>The <code>send()</code> method initiates the request and its optional
1.106 avankest 763:   argument provides the <span>entity body</span>. Authors are strongly
 764:   encouraged to ensure that they have specified the
 765:   <code>Content-Type</code> header via <code>setRequestHeader()</code>
 766:   before invoking <code>send()</code> with a non-<code>null</code>
 767:   <var>data</var> argument.</p>
1.58 avankest 768: 
 769:   <p>When invoked, the user agent <em class="ct">must</em> follow the
1.108 avankest 770:   following steps (unless otherwise noted). Note that this algorithm might
1.109 avankest 771:   get aborted if the <code>open()</code> or <code>abort()</code> is invoked.
 772:   When the
 773:   <dfn title="abort send()" id="abort-send-algorithm"><code>send()</code>
1.110 avankest 774:   algorithm is aborted</dfn> the user agent <em class="ct">must</em>
 775:   terminate the algorithm after finishing the step it is on.</p>
 776: 
1.108 avankest 777:   <p class="note">The following algorithm can not be aborted through script
 778:   when <var>async</var> is <code>false</code>. It can only be aborted when
 779:   <var>async</var> is <code>true</code> and only after the method call has
 780:   returned.</p>
1.58 avankest 781: 
 782:   <ol>
 783:   <li><p>If the state of the object is not
1.96 avankest 784:   <span title="OPEN state">OPEN</span> raise an
1.98 avankest 785:   <code>INVALID_STATE_ERR</code> exception and terminate these
 786:   steps.</p></li>
1.96 avankest 787: 
 788:   <li><p>If the <span><code>send()</code> flag</span> is "true" raise an
1.98 avankest 789:   <code>INVALID_STATE_ERR</code> exception and terminate these
 790:   steps.</p></li>
1.58 avankest 791: 
1.102 avankest 792:   <li><p>If <var>async</var> is <code>true</code> set the
1.103 avankest 793:   <span><code>send()</code> flag</span> to "true".</p></li>
 794: 
1.58 avankest 795:   <li>
 796:    <p>If the <var>data</var> argument has not been omitted and is not
1.96 avankest 797:    <code>null</code> use it for the <dfn id="dfn-entity-body">entity
 798:    body</dfn> as defined by section 7.2 of RFC 2616 observing the following
 799:    rules: [<cite><span>RFC2616</span></cite>]</p>
1.58 avankest 800: 
1.119 ! avankest 801:    <dl class="switch">
1.58 avankest 802:    <dt><var>data</var> is a <code>DOMString</code></dt>
 803: 
1.96 avankest 804:    <dd><p>Encode <var>data</var> using UTF-8 for transmission.</p></dd>
1.58 avankest 805: 
 806:    <dt><var>data</var> is a <code>Document</code>
 807: 
 808:    <dd>
1.96 avankest 809:     <p>Serialize <var>data</var> into a namespace well-formed XML document
 810:     and encoded using the encoding given by
 811:     <code><var>data</var>.xmlEncoding</code>, if specified, or UTF-8
 812:     otherwise. Or, if this fails because the <code>Document</code>
 813:     cannot be serialized act as if <var>data</var> is
 814:     <code>null</code>.</p>
 815: 
 816:     <p>If no <code>Content-Type</code> header is in the list of request
 817:     headers append it to the list of request headers with a value of
 818:     <code>application/xml</code>.</p>
1.58 avankest 819: 
 820:     <p class="note">Subsequent changes to the <code>Document</code> have
 821:     no effect on what is submitted.</p>
 822:    </dd>
 823: 
 824:    <dt><var>data</var> is not a <code>DOMString</code> or
 825:    <code>Document</code></dt>
 826: 
1.96 avankest 827:    <dd><p>Use the stringification mechanisms of the host language on
 828:    <var>data</var> and treat the result as if <var>data</var> is a
 829:    <code>DOMString</code>. Or, if this fails, act as if <var>data</var> is
 830:    <code>null</code>.</p></dd>
1.58 avankest 831:    </dl>
 832: 
 833:    <p>If the data argument has been omitted or is <code>null</code> no
1.96 avankest 834:    entity body is used in the request.</p>
1.58 avankest 835:   </li>
 836: 
1.71 avankest 837:   <li><p>Make a request to <var>stored url</var>, using HTTP method
 838:   <var>stored method</var>, user <var>stored user</var> (if provided) and
 839:   password <var>stored password</var> (if provided), taking into account
 840:   the entity body, list of request headers and the rules listed directly
 841:   after this set of steps.</p></li>
1.60 avankest 842: 
1.67 avankest 843:   <li>
1.96 avankest 844:    <p>Synchronously dispatch a <code>readystatechange</code> event on the
 845:    object.</p>
1.67 avankest 846: 
1.96 avankest 847:    <p class="note">The state of the object does not change. The event is
 848:    dispatched for historical reasons.</p>
1.67 avankest 849:   </li>
 850: 
1.102 avankest 851:   <li><p>If <var>async</var> is <code>true</code> return the
1.98 avankest 852:   <code>send()</code> method call. (Do not terminate the steps in the
 853:   algorithm though.)</p></li>
1.58 avankest 854: 
1.117 avankest 855:   <li>
1.119 ! avankest 856:    <p>While downloading the resource the following is to be observed.</p>
1.118 avankest 857:    
1.119 ! avankest 858:    <dl class="switch">
1.118 avankest 859:    <dt>If the response is an HTTP redirect</dt>
 860:    
 861:    <dd>
 862:     <p>If the redirect does not violate security or infinite loop
 863:     precautions and the scheme is supported transparently follow it and go
 864:     to the start of this step.</p>
 865:     
 866:     <p class="note">HTTP places requirements on the user agent regarding the
 867:     preservation of the request method and entity body during redirects, and
 868:     also requires users to be notified of certain kinds of automatic
 869:     redirections.</p>
 870:     <!-- Arguably HTTP should be fixed for the latter case. No browser
 871:     follows that as far as I know. -->
 872: 
 873:     <p>Otherwise, follow the following set of steps:</p>
 874:     
 875:     <ol>
 876:     <li><p>Set <span>response entity body</span> to "null" and reset the
 877:     list of request headers.</p></li>
 878: 
 879:     <li><p>Synchronously switch the state to
 880:     <span title="DONE state">DONE</span>.</p></li>
 881: 
 882:     <li><p>If <var>async</var> is set to <code>false</code> raise a
 883:     <code>NETWORK_ERR</code> exception and terminate the overall
 884:     algorithm.</p></li>
 885: 
 886:     <li><p>Synchronously dispatch a <code>readystatechange</code> event on
 887:     the object.</p></li>
 888: 
 889:     <li><p>Terminate the overall algorithm.</p></li>
 890:     </ol>
 891: 
 892:     <p class="note">It is likely that a future version of the
 893:     <code>XMLHttpRequest</code> object will dispatch an <code>error</code>
 894:     event here as well.</p>
 895:    </dd>
1.117 avankest 896: 
1.118 avankest 897:    <dt>If the user cancels the download</dt>
1.58 avankest 898: 
1.118 avankest 899:    <dd>
 900:     <p>Run the following set of steps:</p>
1.60 avankest 901: 
1.118 avankest 902:     <ol>
 903:     <li><p>Set <span>response entity body</span> to "null" and reset the
 904:     list of request headers.</p></li>
 905: 
 906:     <li><p>Synchronously switch the state to
 907:     <span title="DONE state">DONE</span>.</p></li>
 908: 
 909:     <li><p>If <var>async</var> is set to <code>false</code> raise a
 910:     <code>NETWORK_ERR</code> exception and terminate the overall
 911:     algorithm.</p></li>
 912: 
 913:     <li><p>Synchronously dispatch a <code>readystatechange</code> event on
 914:     the object.</p></li>
 915: 
 916:     <li><p>Terminate the overall algorithm.</p></li>
 917:     </ol>
 918:     
 919:     <p class="note">It is likely that a future version of the
 920:     <code>XMLHttpRequest</code> object will dispatch an <code>error</code>
 921:     event here as well.</p>
 922:    </dd>
1.60 avankest 923: 
1.118 avankest 924:    <dt>In case of network errors</dt>
1.60 avankest 925: 
1.118 avankest 926:    <dd>
 927:     <p>In case of DNS errors or other type of networks run the following set
 928:     of steps. <span class="note">This does not include HTTP responses that
 929:     indicate some type of error, such as HTTP status code 410.</span></p>
 930: 
 931:     <ol>
 932:     <li><p>Set <span>response entity body</span> to "null" and reset the
 933:     list of request headers.</p></li>
 934: 
 935:     <li><p>Synchronously switch the state to
 936:     <span title="DONE state">DONE</span>.</p></li>
 937: 
 938:     <li><p>If <var>async</var> is set to <code>false</code> raise a
 939:     <code>NETWORK_ERR</code> exception and terminate the overall
 940:     algorithm.</p></li>
 941: 
 942:     <li><p>Synchronously dispatch a <code>readystatechange</code> event on
 943:     the object.</p></li>
 944: 
 945:     <li><p>Terminate the overall algorithm.</p></li>
 946:     </ol>
 947: 
 948:     <p class="note">It is likely that a future version of the
 949:     <code>XMLHttpRequest</code> object will dispatch an <code>error</code>
 950:     event here as well.</p>
 951:    </dd>
 952:    
 953:    <dt>Once all HTTP headers have been received</dt>
 954:    
 955:    <dd>
 956:     <p>If all HTTP headers have been received, before receiving the message
 957:     body (if any), follow the following steps:</p>
1.60 avankest 958: 
1.118 avankest 959:     <ol>
 960:     <li><p>Synchronously switch the state to
 961:     <span title="SENT state">SENT</span>.</p></li>
 962: 
 963:     <li><p>Synchronously dispatch a <code>readystatechange</code> event on
 964:     the object.</p></li>
 965: 
 966:     <li><p>Synchronously switch the state to
 967:     <span title="LOADING state">LOADING</span>.</p></li>
 968: 
 969:     <li><p>Synchronously dispatch a <code>readystatechange</code> event on
 970:     the object.</p></li>
 971:     </ol>
 972:    </dd>
 973:    </dl>
 974:    
 975:    <p>Finally, if the complete resource has been downloaded go to the next
 976:    step.</p>
1.58 avankest 977:   </li>
 978: 
1.82 avankest 979:   <li><p>When the request has successfully completed loading, synchronously
1.96 avankest 980:   switch the state to <span title="DONE state">DONE</span> and then
 981:   synchronously dispatch a <code>readystatechange</code> event on the
 982:   object and return the method call in case of <var>async</var> being
 983:   <code>false</code>.</p></li>
1.58 avankest 984:   </ol>
1.14 avankest 985: 
1.91 avankest 986:   <p>If the user agent allows the user to configure a proxy it
1.22 avankest 987:   <em class="ct">should</em> modify the request appropriately;
1.42 avankest 988:   <abbr title="in other words">i.e.</abbr>, connect to the proxy host
 989:   instead of the origin server, modify the <code>Request-Line</code> and
 990:   send <code>Proxy-Authorization</code> headers as specified.</p>
1.12 avankest 991: 
1.42 avankest 992:   <p>If the user agent supports HTTP Authentication it
1.22 avankest 993:   <em class="ct">should</em> consider requests originating from this object
1.42 avankest 994:   to be part of the protection space that includes the accessed URIs and
 995:   send <code>Authorization</code> headers and handle <code>401
1.72 avankest 996:   Unauthorised</code> requests appropriately. If authentication fails, user
1.42 avankest 997:   agents <em class="ct">should</em> prompt the users for credentials.
 998:   [<cite><span>RFC2617</span></cite>]</p>
 999: 
1.57 avankest 1000:   <p>If the user agent supports HTTP State Management it
1.42 avankest 1001:   <em class="ct">should</em> persist, discard and send cookies (as received
 1002:   in the <code>Set-Cookie</code> and <code>Set-Cookie2</code> response
 1003:   headers, and sent in the <code>Cookie</code> header) as applicable.
 1004:   [<cite><span>RFC2965</span></cite>]</p>
 1005: 
 1006:   <p>If the user agent implements a HTTP cache it <em class="ct">should</em>
 1007:   respect <code>Cache-Control</code> request headers set by the script
 1008:   (<abbr title="for example">e.g.</abbr>, <code>Cache-Control:
 1009:   no-cache</code> bypasses the cache). It <em class="ct">must not</em> send
 1010:   <code>Cache-Control</code> or <code>Pragma</code> request headers
 1011:   automatically unless the user explicitly requests such behaviour
 1012:   (<abbr>e.g.</abbr>, by (force-)reloading the page). <code>304 Not
1.22 avankest 1013:   Modified</code> responses that are a result of a user agent generated
 1014:   conditional request <em class="ct">must</em> be presented as <code>200
1.57 avankest 1015:   OK</code> responses with the appropriate content. The user agent
1.39 avankest 1016:   <em class="ct">must</em> allow scripts to override automatic cache
1.22 avankest 1017:   validation by setting request headers (e.g., <code>If-None-Match</code>,
1.42 avankest 1018:   <code>If-Modified-Since</code>), in which case <code>304 Not
 1019:   Modified</code> responses <em class="ct">must</em> be passed through.
 1020:   [<cite><span>RFC2616</span></cite>]</p>
1.12 avankest 1021: 
1.8 avankest 1022:   <p>If the user agent implements server-driven content-negotiation
1.42 avankest 1023:   it <em class="ct">should</em> set <code>Accept-Language</code>,
1.22 avankest 1024:   <code>Accept-Encoding</code> and <code>Accept-Charset</code> headers as
 1025:   appropriate; it <em class="ct">must not</em> automatically set the
 1026:   <code>Accept</code> header. Responses to such requests
1.40 avankest 1027:   <em class="ct">must</em> have the content-codings automatically
1.42 avankest 1028:   decoded. [<cite><span>RFC2616</span></cite>]</p>
1.8 avankest 1029:  </dd>
1.12 avankest 1030: 
1.14 avankest 1031:  <dt><dfn id="dfn-abort"><code>abort()</code></dfn>, method</dt>
1.12 avankest 1032: 
1.5 avankest 1033:  <dd>
1.60 avankest 1034:   <p>When invoked, the user agent <em class="ct">must</em> run the following
1.96 avankest 1035:   steps (unless otherwise noted):</p>
1.60 avankest 1036: 
 1037:   <ol>
1.108 avankest 1038:   <li><p><span title="abort send()">Abort the <code>send()</code>
 1039:   algorithm</span>, set the <span>response entity body</span> to "null",
 1040:   set the <span><code>send()</code> flag</span> to "false" and remove any
1.104 avankest 1041:   registered request headers.</p></li>
1.60 avankest 1042: 
1.108 avankest 1043:   <li><p>The user agent <em class="ct">should</em> cancel any network
 1044:   activity for which the object is responsible.</p></li>
1.60 avankest 1045: 
1.83 avankest 1046:   <li>
1.85 avankest 1047:    <p>If the state is <span title="UNSENT state">UNSENT</span>,
1.83 avankest 1048:    <span title="OPEN state">OPEN</span> and the <span><code>send()</code>
1.87 avankest 1049:    flag</span> is "false", or <span title="DONE state">DONE</span> go to
 1050:    the next step.</p>
1.85 avankest 1051: 
1.96 avankest 1052:    <p>Otherwise, switch the state to <span title="DONE state">DONE</span>
 1053:    and synchronously dispatch a <code>readystatechange</code> event on the
 1054:    object.</p>
1.83 avankest 1055:   </li>
1.67 avankest 1056: 
1.60 avankest 1057:   <li>
1.97 avankest 1058:    <p>Switch the state to <span title="UNSENT state">UNSENT</span>. (Do not
1.71 avankest 1059:    dispatch the <code>readystatechange</code> event.)</p>
1.60 avankest 1060: 
1.82 avankest 1061:    <p class="note">It is likely that a future version of the
 1062:    <code>XMLHttpRequest</code> object will dispatch an
 1063:    <code title="">abort</code> event here as well.</p>
1.60 avankest 1064:   </li>
 1065:   </ol>
1.5 avankest 1066:  </dd>
1.12 avankest 1067: 
1.14 avankest 1068:  <dt><dfn id="dfn-getallresponseheaders"><code>getAllResponseHeaders()</code></dfn>,
1.22 avankest 1069:  method</dt>
1.12 avankest 1070: 
1.5 avankest 1071:  <dd>
1.60 avankest 1072:   <p>When invoked, the user agent <em class="ct">must</em> run
1.58 avankest 1073:   the following steps:</p>
 1074: 
 1075:   <ol>
1.86 avankest 1076:   <li><p>If the state is not <span title="LOADING state">LOADING</span> or
1.96 avankest 1077:   <span title="DONE state">DONE</span> raise an
1.98 avankest 1078:   <code>INVALID_STATE_ERR</code> exception and terminate these
 1079:   steps.</p></li>
1.96 avankest 1080: 
 1081:   <li><p>Return all the HTTP headers, as a single string, with each header
 1082:   line separated by a U+000D CR U+000A LF pair excluding the status
 1083:   line.</p></li>
1.58 avankest 1084:   </ol>
1.24 avankest 1085: 
1.5 avankest 1086:   <div class="example">
1.58 avankest 1087:   <pre><code>// The following script:
1.5 avankest 1088: var client = new XMLHttpRequest();
1.14 avankest 1089: client.open("GET", "test.txt", true);
1.5 avankest 1090: client.send();
1.12 avankest 1091: client.onreadystatechange = function() {
1.13 avankest 1092: if(this.readyState == 3) {
1.12 avankest 1093:  print(this.getAllResponseHeaders());
 1094: }
 1095: }
1.5 avankest 1096: 
 1097: // ...should output something similar to the following text:
 1098: Date: 2004年10月24日 04:58:38 GMT
 1099: Server: Apache/1.3.31 (Unix)
 1100: Keep-Alive: timeout=15, max=99
 1101: Connection: Keep-Alive
 1102: Transfer-Encoding: chunked
1.58 avankest 1103: Content-Type: text/plain; charset=utf-8</code></pre>
1.5 avankest 1104:   </div>
 1105:  </dd>
1.12 avankest 1106: 
1.18 avankest 1107:  <dt><dfn id="dfn-getresponseheader" title="getresponseheader"><code>getResponseHeader(<var>header</var>)</code></dfn>,
1.22 avankest 1108:  method</dt>
1.12 avankest 1109: 
1.1 avankest 1110:  <dd>
1.58 avankest 1111:   <p>When the method is invoked, the user agent <em class="ct">must</em> run
 1112:   the following steps:</p>
1.14 avankest 1113: 
1.58 avankest 1114:   <ol>
1.86 avankest 1115:   <li><p>If the state is not <span title="LOADING state">LOADING</span> or
1.96 avankest 1116:   <span title="DONE state">DONE</span> raise an
1.98 avankest 1117:   <code>INVALID_STATE_ERR</code> exception and terminate these
 1118:   steps.</p></li>
1.58 avankest 1119: 
1.97 avankest 1120:   <li><p>If the <var>header</var> argument does not match the
1.96 avankest 1121:   <span><code>field-name</code> production</span> raise a
1.98 avankest 1122:   <code>SYNTAX_ERR</code> exception and terminate these steps.</p></li>
1.58 avankest 1123: 
1.80 avankest 1124:   <li><p>If the <var>header</var> argument
 1125:   <span title="case-insensitive match">case-insensitively matches</span>
1.96 avankest 1126:   multiple HTTP headers for the last request sent return the values of
 1127:   these headers as a single concatenated string separated from each other
1.98 avankest 1128:   by an U+002C COMMA followed by an U+0020 SPACE and terminate these
1.96 avankest 1129:   steps.</p></li>
1.58 avankest 1130: 
1.80 avankest 1131:   <li><p>If the <var>header</var> argument
 1132:   <span title="case-insensitive match">case-insensitively matches</span> a
1.96 avankest 1133:   single HTTP header for the last request sent return the value of that
1.98 avankest 1134:   header and terminate these steps.</p></li>
1.58 avankest 1135: 
1.96 avankest 1136:   <li><p>Return <code>null</code>.</p></li>
1.58 avankest 1137:   </ol>
1.12 avankest 1138: 
1.1 avankest 1139:   <div class="example">
1.58 avankest 1140:   <pre><code>// The following script:
1.1 avankest 1141: var client = new XMLHttpRequest();
1.14 avankest 1142: client.open("GET", "test.txt", true);
1.5 avankest 1143: client.send();
1.12 avankest 1144: client.onreadystatechange = function() {
1.13 avankest 1145: if(this.readyState == 3) {
1.14 avankest 1146:  print(client.getResponseHeader("Content-Type"));
1.12 avankest 1147: }
 1148: }
1.1 avankest 1149: 
1.5 avankest 1150: // ...should output something similar to the following text:
1.58 avankest 1151: Content-Type: text/plain; charset=utf-8</code></pre>
1.1 avankest 1152:   </div>
1.5 avankest 1153:  </dd>
1.12 avankest 1154: 
1.5 avankest 1155:  <dt><dfn id="dfn-responsetext"><code>responseText</code></dfn> of type
1.22 avankest 1156:  <code>DOMString</code>, readonly</dt>
1.12 avankest 1157: 
1.5 avankest 1158:  <dd>
1.88 avankest 1159:   <p>On getting, the user agent <em class="ct">must</em> run the following
 1160:   steps:</p>
 1161: 
 1162:   <ol>
 1163:   <li><p>If the state is not <span title="LOADING state">LOADING</span> or
1.96 avankest 1164:   <span title="DONE state">DONE</span> raise an
1.98 avankest 1165:   <code>INVALID_STATE_ERR</code> exception and terminate these
 1166:   steps.</p></li>
1.12 avankest 1167: 
1.88 avankest 1168:   <li><p>Return the <span>text response entity body</span>.</p></li>
 1169:   </ol>
1.5 avankest 1170:  </dd>
1.12 avankest 1171: 
1.5 avankest 1172:  <dt><dfn id="dfn-responsexml"><code>responseXML</code></dfn> of type
1.22 avankest 1173:  <code>Document</code>, readonly</dt>
1.12 avankest 1174: 
1.8 avankest 1175:  <dd>
1.75 avankest 1176:   <p>On getting, the user agent <em class="ct">must</em> run the following
 1177:   steps:</p>
1.79 avankest 1178: 
1.75 avankest 1179:   <ol>
1.96 avankest 1180:   <li><p>If the state is not <span title="DONE state">DONE</span> raise an
1.98 avankest 1181:   <code>INVALID_STATE_ERR</code> exception and terminate these
 1182:   steps.</p></li>
1.75 avankest 1183: 
1.88 avankest 1184:   <li><p>Return the <span>XML response entity body</span>.</p></li>
1.75 avankest 1185:   </ol>
1.5 avankest 1186:  </dd>
1.12 avankest 1187: 
1.22 avankest 1188:  <dt><dfn id="dfn-status"><code>status</code></dfn> of type <code>unsigned
 1189:  short</code>, readonly</dt>
1.12 avankest 1190: 
1.5 avankest 1191:  <dd>
1.72 avankest 1192:   <p>On getting, if available, it <em class="ct">must</em> return the HTTP
 1193:   status code sent by the server (typically <code>200</code> for a
 1194:   successful request). Otherwise, if not available, the user agent
 1195:   <em class="ct">must</em> raise an <code>INVALID_STATE_ERR</code>
 1196:   exception.</p>
1.12 avankest 1197:  </dd>
 1198: 
1.5 avankest 1199:  <dt><dfn id="dfn-statustext"><code>statusText</code></dfn> of type
1.22 avankest 1200:  <code>DOMString</code>, readonly</dt>
1.12 avankest 1201: 
1.5 avankest 1202:  <dd>
1.72 avankest 1203:   <p>On getting, if available, it <em class="ct">must</em> return the HTTP
 1204:   status text sent by the server (appears after the status code). Otherwise,
 1205:   if not available, the user agent <em class="ct">must</em> raise an
 1206:   <code>INVALID_STATE_ERR</code> exception.</p>
1.1 avankest 1207:  </dd>
 1208:  </dl>
1.12 avankest 1209: 
1.31 avankest 1210:  <h3 id="events">Events for the <code title="">XMLHttpRequest</code>
 1211:  Object</h3>
1.12 avankest 1212: 
1.1 avankest 1213:  <p>These sections describe the various events that can be dispatched on the
1.22 avankest 1214:  object implementing the <code>XMLHttpRequest</code> interface. For this
 1215:  version of the specification only one event is defined.</p>
1.12 avankest 1216: 
1.1 avankest 1217:  <dl>
 1218:  <dt><dfn id="dfn-readystatechange"><code>readystatechange</code></dfn></dt>
1.24 avankest 1219: 
1.72 avankest 1220:  <dd>When the user agent dispatches a <code title="">readystatechange</code>
 1221:  event (as indicated above) it <em class="ct">must not</em> bubble,
 1222:  <em class="ct">must not</em> be cancelable and <em class="ct">must</em>
 1223:  implement the <code>Event</code> interface. Its <code>namespaceURI</code>
 1224:  attribute <em class="ct">must</em> be <code>null</code>.
 1225:  [<cite><span>DOM3Events</span></cite>]</dd>
1.1 avankest 1226:  </dl>
1.32 avankest 1227: 
1.31 avankest 1228:  <h3 id="exceptions">Exceptions for the <code title="">XMLHttpRequest</code>
 1229:  Object</h3>
 1230: 
1.117 avankest 1231:  <pre class="idl">exception <dfn>XMLHttpRequestException</dfn> {
1.31 avankest 1232:  unsigned short   code;
1.117 avankest 1233: };
1.31 avankest 1234: const unsigned short <span>NETWORK_ERR</span> = 101;</pre>
 1235: 
1.33 avankest 1236:  <p>The <dfn id="network-err"><code>NETWORK_ERR</code></dfn> exception is
 1237:  thrown when a network error occurs in synchronous requests. See the section
 1238:  on <code>send()</code> for more details.</p>
1.11 avankest 1239: 
1.29 avankest 1240:  <h2 class="no-num" id="notcovered">Not in this Specification</h2>
 1241: 
 1242:  <p><em>This section is non normative.</em></p>
 1243: 
1.72 avankest 1244:  <p>This specification does not include the following features which are
 1245:  being considered for a future version of this specification:</p>
1.29 avankest 1246: 
 1247:  <ul>
 1248:  <li><code>load</code> event and <code>onload</code> attribute;</li>
 1249:  <li><code>error</code> event and <code>onerror</code> attribute;</li>
 1250:  <li><code>progress</code> event and <code>onprogress</code> attribute;</li>
 1251:  <li><code title="">abort</code> event and <code>onabort</code> attribute;</li>
 1252:  <li>Timers have been suggested, perhaps an <code>ontimeout</code>
 1253:   attribute;</li>
 1254:  <li>Property to disable following redirects;</li>
1.30 avankest 1255:  <li><code title="">responseXML</code> for <code>text/html</code>
 1256:  documents;</li>
1.40 avankest 1257:  <li>Cross-site <code title="">XMLHttpRequest</code>;</li>
1.87 avankest 1258:  <li><code>responseBody</code> to deal with byte streams;</li>
1.114 avankest 1259:  <li><code>overrideMimeType</code> to fix up MIME types;</li>
1.87 avankest 1260:  <li><code>getRequestHeader()</code> and
 1261:  <code>removeRequestHeader()</code>.</li>
1.29 avankest 1262:  </ul>
 1263: 
1.1 avankest 1264:  <h2 class="no-num" id="bibref">References</h2>
1.11 avankest 1265: 
1.6 avankest 1266:  <dl>
1.37 avankest 1267:  <dt>[<dfn id="DOM3">DOM3Core</dfn>]</dt>
1.24 avankest 1268: 
1.11 avankest 1269:  <dd><cite><a href="http://www.w3.org/TR/DOM-Level-3-Core">Document Object
1.92 avankest 1270:  Model (DOM) Level 3 Core Specification</a></cite>, A. Le Hors, P. Le
1.117 avankest 1271:  Hégaret, L. Wood, G. Nicol, J. Robie, M. Champion, S. Byrne, editors. W3C,
 1272:  April 2004.</dd>
1.11 avankest 1273: 
1.37 avankest 1274:  <dt>[<dfn id="DOM3EV">DOM3Events</dfn>]</dt>
1.24 avankest 1275: 
1.92 avankest 1276:  <dd><cite><a href="http://www.w3.org/TR/DOM-Level-3-Events/">Document
 1277:  Object Model (DOM) Level 3 Events Specification</a></cite>, Björn Höhrmann,
1.117 avankest 1278:  editor. W3C, April 2006.</dd>
1.11 avankest 1279: 
1.117 avankest 1280:  <dt>[<dfn id="ref-ecmascript">ECMAScript</dfn>]</dt>
1.24 avankest 1281: 
1.92 avankest 1282:  <dd><cite><a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMAScript
 1283:  Language Specification</a></cite>, Third Edition. ECMA, December 1999.</dd>
1.14 avankest 1284: 
1.37 avankest 1285:  <dt>[<dfn id="ref-rfc2046">RFC2046</dfn>]</dt>
1.24 avankest 1286: 
1.19 avankest 1287:  <dd><cite><a href="http://ietf.org/rfc/rfc2046">Multipurpose Internet Mail
1.92 avankest 1288:  Extensions (MIME) Part Two: Media Types</a></cite>, N. Freed, N.
 1289:  Borenstein, editors. IETF, November 1996.</dd>
1.14 avankest 1290: 
1.37 avankest 1291:  <dt>[<dfn id="RFC2119">RFC2119</dfn>]</dt>
1.24 avankest 1292: 
1.117 avankest 1293:  <dd><cite><a href="http://ietf.org/rfc/rfc2119">Key words for use in RFCs to
 1294:  Indicate Requirement Levels</a></cite>, S. Bradner. IETF, March 1997.</dd>
1.12 avankest 1295: 
1.37 avankest 1296:  <dt>[<dfn id="RFC2616">RFC2616</dfn>]</dt>
1.24 avankest 1297: 
1.11 avankest 1298:  <dd><cite><a href="http://ietf.org/rfc/rfc2616">Hypertext Transfer Protocol
1.92 avankest 1299:  -- HTTP/1.1</a></cite>, R. Fielding, J. Gettys, J. Mogul, H. Frystyk, L.
 1300:  Masinter, P. Leach, T. Berners-Lee, editors. IETF, June 1999.</dd>
1.12 avankest 1301: 
1.37 avankest 1302:  <dt>[<dfn id="ref-rfc2617">RFC2617</dfn>]</dt>
1.24 avankest 1303: 
1.11 avankest 1304:  <dd><cite><a href="http://ietf.org/rfc/rfc2617">HTTP Authentication: Basic
1.92 avankest 1305:  and Digest Access Authentication</a></cite>, P. Hallam-Baker, J.
 1306:  Hostetler, S. Lawrence, P. Leach, A. Luotonen, L. Stewart, editors. IETF,
 1307:  June 1999.</dd>
1.12 avankest 1308: 
1.37 avankest 1309:  <dt>[<dfn id="ref-rfc2965">RFC2965</dfn>]</dt>
1.24 avankest 1310: 
1.19 avankest 1311:  <dd><cite><a href="http://ietf.org/rfc/rfc2965">HTTP State Management
1.92 avankest 1312:  Mechanism</a></cite>, D. Kristol, L. Montulli, editors. IETF, October
 1313:  2000.</dd>
1.19 avankest 1314: 
1.37 avankest 1315:  <dt>[<dfn id="ref-rfc3986">RFC3986</dfn>]</dt>
1.24 avankest 1316: 
1.11 avankest 1317:  <dd><cite><a href="http://ietf.org/rfc/rfc3986">Uniform Resource Identifier
1.92 avankest 1318:  (URI): Generic Syntax</a></cite>, T. Berners-Lee, R. Fielding, L. Masinter,
 1319:  editors. IETF, January 2005.</dd>
1.28 avankest 1320: 
1.92 avankest 1321:  <dt>[<dfn id="ref-window">Window</dfn>]</dt>
1.28 avankest 1322: 
1.92 avankest 1323:  <dd><cite><a href="http://www.w3.org/TR/Window/">Window Object
 1324:  1.0</a></cite>, I. Davis, M. Stachowiak, editors. W3C, April 2006.</dd>
1.41 avankest 1325: 
1.92 avankest 1326:  <dt>[<dfn id="ref-xml">XML</dfn>]</dt>
1.41 avankest 1327: 
1.92 avankest 1328:  <dd><cite><a href="http://www.w3.org/TR/xml/">Extensible Markup Language
 1329:  (XML) 1.0 (Fourth Edition)</a></cite>, T. Bray, J. Paoli, C.
1.117 avankest 1330:  Sperberg-McQueen, E. Maler, F. Yergeau, editors. W3C, September 2006.</dd>
1.41 avankest 1331: 
1.92 avankest 1332:  <dt>[<dfn id="ref-xmlns">XMLNS</dfn>]</dt>
1.41 avankest 1333: 
1.92 avankest 1334:  <dd><cite><a href="http://www.w3.org/TR/xml-names/">Namespaces in XML
1.117 avankest 1335:  (Second Edition)</a></cite>, T. Bray, D. Hollander, A. Layman, R. Tobin,
 1336:  editors. W3C, August 2006.</dd>
1.1 avankest 1337:  </dl>
1.11 avankest 1338: 
1.1 avankest 1339:  <h2 class="no-num" id="acknowledgements">Acknowledgements</h2>
1.11 avankest 1340: 
1.1 avankest 1341:  <p><em>This section is non-normative</em></p>
1.12 avankest 1342: 
1.7 avankest 1343:  <p>The editor would like to thank to the following people who have contributed
1.33 avankest 1344:  to this specification (ordered by first name):</p>
1.12 avankest 1345: 
1.1 avankest 1346:  <ul>
1.112 avankest 1347:  <li>Ahmed Kamel</li>
1.22 avankest 1348:  <li>Alex Hopmann</li>
1.7 avankest 1349:  <li>Alex Vincent</li>
1.15 avankest 1350:  <li>Alexey Proskuryakov</li>
1.1 avankest 1351:  <li>Asbjørn Ulsberg</li>
 1352:  <li>Boris Zbarsky</li>
 1353:  <li>Björn Höhrmann</li>
 1354:  <li>Cameron McCormack</li>
 1355:  <li>Christophe Jolif</li>
 1356:  <li>Charles McCathieNevile</li>
1.54 avankest 1357:  <li>Dan Winship</li>
1.72 avankest 1358:  <li>David Håsäther</li>
1.1 avankest 1359:  <li>Dean Jackson</li>
 1360:  <li>Doug Schepers</li>
 1361:  <li>Douglas Livingstone</li>
1.112 avankest 1362:  <li>Eric Lawrence</li>
 1363:  <li>Gideon Cohn</li>
1.1 avankest 1364:  <li>Gorm Haug Eriksen</li>
 1365:  <li>Hallvord R. M. Steen</li>
 1366:  <li>Håkon Wium Lie</li>
 1367:  <li>Ian Davis</li>
 1368:  <li>Ian Hickson</li>
 1369:  <li>Ivan Herman</li>
 1370:  <li>Jens Lindström</li>
 1371:  <li>Jim Deegan</li>
 1372:  <li>Jim Ley</li>
1.112 avankest 1373:  <li>Joe Farro</li>
1.1 avankest 1374:  <li>Jonas Sicking</li>
 1375:  <li>Julian Reschke</li>
 1376:  <li>Karl Dubost</li>
 1377:  <li>Maciej Stachowiak</li>
1.7 avankest 1378:  <li>Magnus Kristiansen</li>
1.1 avankest 1379:  <li>Marc Hadley</li>
1.53 avankest 1380:  <li>Marcos Caceres</li>
1.87 avankest 1381:  <li>Mark Baker</li>
1.1 avankest 1382:  <li>Mark Nottingham</li>
1.92 avankest 1383:  <li>Mohamed Zergaoui</li>
1.1 avankest 1384:  <li>Pawel Glowacki</li>
 1385:  <li>Robin Berjon</li>
 1386:  <li>Ruud Steltenpool</li>
1.33 avankest 1387:  <li>Simon Pieters</li>
1.112 avankest 1388:  <li>Sunava Dutta</li>
 1389:  <li>Zhenbin Xu</li>
1.1 avankest 1390:  </ul>
1.12 avankest 1391: 
1.1 avankest 1392:  <p>Special thanks to the Microsoft employees who first implemented the
1.22 avankest 1393:  <code>XMLHttpRequest</code> interface, which was first widely deployed by the
 1394:  Windows Internet Explorer browser.</p>
1.12 avankest 1395: 
1.54 avankest 1396:  <p>Special thanks also to the WHATWG for drafting an initial version of this
1.22 avankest 1397:  specification in their Web Applications 1.0 document.</p>
1.12 avankest 1398: 
1.1 avankest 1399:  <p>Thanks also to all those who have helped to improve this specification by
1.22 avankest 1400:  sending suggestions and corrections. (Please, keep bugging us with your
 1401:  issues!)</p>
1.1 avankest 1402: </body>
 1403: </html>
Webmaster