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