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