Annotation of 2006/webapi/XMLHttpRequest/Overview.src.html, revision 1.22
1.1 avankest 1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
2: <html lang="en-US">
3: <head>
4: <title>The XMLHttpRequest Object</title>
1.16 avankest 5: <style type="text/css">
6: pre.idl { border:solid thin; background:#eee; color:#000; padding:0.5em }
7: pre.idl :link, pre.idl :visited { color:inherit; background:transparent }
8: div.example { margin-left:1em; padding-left:1em; border-left:double; color:#222; background:#fcfcfc }
9: p.note { margin-left:2em; font-weight:bold; font-style:italic; color:#008000 }
10: p.note::before { content:"Note: " }
11: p.issue { padding:.5em; border:solid #f00 }
12: p.issue::before { content:"Issue: " }
13: em.ct { text-transform:lowercase; font-variant:small-caps; font-style:normal }
14: dfn { font-weight:bold; font-style:normal }
15: code { color:orangered }
16: code :link, code :visited { color:inherit }
17: </style>
1.7 avankest 18: <link rel="stylesheet" href="http://www.w3.org/StyleSheets/TR/base">
1.1 avankest 19: </head>
20: <body>
21: <div class="head">
22: <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 23:
1.10 avankest 24: <h1 class="head">The <code title="">XMLHttpRequest</code> Object</h1>
1.12 avankest 25:
1.22 ! avankest 26: <h2 class="no-num no-toc" id="pagesubtitle">Editors' draft <!--W3C Working Draft--> [DATE: 3 August 2002]</h2>
1.12 avankest 27:
1.1 avankest 28: <dl>
1.10 avankest 29: <dt>This Version:</dt>
1.22 ! avankest 30:
! 31: <dd><a href="[VERSION]">http://www.w3.org/TR/[YEAR]/WD-XMLHttpRequest-[CDATE]/</a></dd>
1.14 avankest 32:
1.10 avankest 33: <dt>Latest Version:</dt>
1.22 ! avankest 34:
1.1 avankest 35: <dd><a href="http://www.w3.org/TR/XMLHttpRequest/">http://www.w3.org/TR/XMLHttpRequest/</a></dd>
1.14 avankest 36:
1.10 avankest 37: <dt>Previous Versions:</dt>
1.22 ! avankest 38:
! 39: <dd><a href="http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060927/">http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060927/</a></dd>
! 40:
1.1 avankest 41: <dd><a href="http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060619/">http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060619/</a></dd>
1.22 ! avankest 42:
1.1 avankest 43: <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 44:
1.1 avankest 45: <dt>Editor:</dt>
1.22 ! avankest 46:
1.1 avankest 47: <dd><a href="http://annevankesteren.nl/">Anne van Kesteren</a>
48: (<a href="http://www.opera.com/">Opera Software ASA</a>)
49: <<a href="mailto:annevk@opera.com">annevk@opera.com</a>></dd>
50: </dl>
1.14 avankest 51:
1.1 avankest 52: <p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>
53: ©2006
54: <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup>
55: (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>,
56: <a href="http://www.ercim.org/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>,
57: <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C
58: <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
59: <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
60: and
61: <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document
62: use</a> rules apply.
63: </p>
64: </div>
1.12 avankest 65:
1.1 avankest 66: <hr>
1.12 avankest 67:
1.1 avankest 68: <h2 class="no-num no-toc" id="specabstract">Abstract</h2>
1.10 avankest 69:
1.22 ! avankest 70: <p class="issue">Need author requirements and perhaps require support for HTTP
! 71: and HTTPS.</p>
! 72:
! 73: <p>The <code title="">XMLHttpRequest</code> Object specification defines an
! 74: <abbr title="Application Programming Interface">API</abbr> that provides
! 75: scripted client functionality for transferring data between a client and a
! 76: server.</p>
1.12 avankest 77:
1.1 avankest 78: <h2 class="no-num no-toc" id="sotd">Status of this Document</h2>
1.12 avankest 79:
1.1 avankest 80: <p><em>This section describes the status of this document at the time of its
81: publication. Other documents may supersede this document. A list of current
82: W3C publications and the latest revision of this technical report can be
83: found in the <a href="http://www.w3.org/TR/">W3C technical reports index</a>
84: at http://www.w3.org/TR/.</em></p>
1.12 avankest 85:
1.22 ! avankest 86: <p>This is the [DATE: 3 August 2002] Working Draft of The
1.20 avankest 87: <code title="">XMLHttpRequest</code> Object. This document is produced by the
88: <a href="http://www.w3.org/2006/webapi/">Web APIs WG</a>, part of the
89: <a href="http://www.w3.org/2006/rwc/Activity">Rich Web Clients Activity</a>
90: in the W3C <a href="http://www.w3.org/Interaction/">Interaction
91: Domain</a>.</p>
1.12 avankest 92:
1.1 avankest 93: <p>Web content and browser developers are encouraged to review this draft.
94: Please send comments to
95: <a href="mailto:public-webapi@w3.org">public-webapi@w3.org</a>, the W3C's
96: public email list for issues related to Web APIs.
97: <a href="http://lists.w3.org/Archives/Public/public-webapi/">Archives</a> of
98: the list are available.</p>
1.12 avankest 99:
1.1 avankest 100: <p>Implementors should be aware that this specification is not stable.
101: <strong>Implementors who are not taking part in the discussions are likely
102: to find the specification changing out from under them in incompatible
103: ways.</strong> Vendors interested in implementing this specification
104: before it eventually reaches the Candidate Recommendation stage should
105: join the aforementioned mailing list and take part in the discussions.</p>
1.12 avankest 106:
1.1 avankest 107: <p>Publication as a Working Draft does not imply endorsement by the W3C
108: Membership. This is a draft document and may be updated, replaced or
109: obsoleted by other documents at any time. It is inappropriate to cite this
110: document as other than work in progress.</p>
1.12 avankest 111:
1.1 avankest 112: <p>This document was produced by a group operating under the
113: <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February
114: 2004 W3C Patent Policy</a>. This document is informative only. W3C maintains
115: a
116: <a rel="disclosure" href="http://www.w3.org/2004/01/pp-impl/38482/status">public
117: list of any patent disclosures</a> made in connection with the deliverables
118: of the group; that page also includes instructions for disclosing a patent.
119: An individual who has actual knowledge of a patent which the individual
120: believes contains
121: <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential
122: Claim(s)</a> must disclose the information in accordance with
123: <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
124: 6 of the W3C Patent Policy</a>.</p>
1.12 avankest 125:
1.1 avankest 126: <h2 class="no-num no-toc" id="toc">Table of Contents</h2>
1.21 avankest 127:
1.1 avankest 128: <!--toc-->
1.12 avankest 129:
1.1 avankest 130: <h2 id="introduction">Introduction</h2>
1.12 avankest 131:
1.1 avankest 132: <p><em>This section is non-normative.</em></p>
1.12 avankest 133:
1.22 ! avankest 134: <p>The <code>XMLHttpRequest</code> object implements an interface exposed by a
! 135: scripting engine that allows scripts to perform HTTP client functionality,
! 136: such as submitting form data or loading data from a server.</p>
! 137:
1.1 avankest 138: <p>The name of the object is <code>XMLHttpRequest</code> for compatibility
1.22 ! avankest 139: with the web, though each component of this name is potentially misleading.
! 140: First, the object is data transport agnostic — it supports any data format,
! 141: including XML. Second, it can be used to make requests over both HTTP and
! 142: HTTPS (some implementations support protocols in addition to HTTP and HTTPS,
! 143: but that functionality is not covered by this specification). Finally, it
! 144: supports "requests" in a broad sense of the term as it pertains to HTTP;
! 145: namely all activity involved with HTTP requests or responses for the defined
! 146: HTTP methods.</p>
1.12 avankest 147:
1.1 avankest 148: <h3 id="history">History</h3>
1.12 avankest 149:
1.1 avankest 150: <p><em>This section is non-normative.</em></p>
1.12 avankest 151:
1.1 avankest 152: <p>The <code>XMLHttpRequest</code> object has been implemented for many years
1.22 ! avankest 153: as ActiveX control in the Windows Internet Explorer browser and has later been
! 154: adopted by other popular web browsers. Unfortunately the current
! 155: implementations are not completely interoperable. Based on those early
! 156: implementations this specification defines how a common subset of
! 157: <code>XMLHttpRequest</code> should work and this will probably result in
! 158: changes in said implementations leading to more interoperable and useful
! 159: implementations of the <code>XMLHttpRequest</code> object.</p>
1.12 avankest 160:
1.1 avankest 161: <p>Future versions of this specification (as opposed to future drafts of this
1.22 ! avankest 162: version) may add <a href="#notcovered">new features</a>, after careful
! 163: examination from browser developers and Web content developers.</p>
1.12 avankest 164:
1.1 avankest 165: <h3 id="examples">Examples of Usage</h3>
1.12 avankest 166:
1.1 avankest 167: <p><em>This section is non-normative.</em></p>
1.12 avankest 168:
1.14 avankest 169: <p>Various [<cite><a href="#ref-ecmascript">ECMAScript</a></cite>] examples
1.22 ! avankest 170: are listed throughout the specification. In addition, you can find some
! 171: below.</p>
1.14 avankest 172:
173: <div class="example">
174: <p>Some simple code to do something with data from an XML document fetched
1.22 ! avankest 175: over the network:</p>
1.16 avankest 176:
1.14 avankest 177: <pre>function test(data) {
178: // taking care of data
179: }
180:
181: function handler() {
182: if(this.readyState == 4 && this.status == 200) {
183: // so far so good
184: if(this.responseXML != null && this.responseXML.getElementById('test').firstChild.data)
185: // success!
186: test(this.responseXML.getElementById('test').firstChild.data);
187: else
188: test(null);
189: } else if (this.readyState == 4 && this.status != 200) {
190: // fetched the wrong page or network error...
191: test(null);
192: }
193: }
1.12 avankest 194:
1.14 avankest 195: var client = new XMLHttpRequest();
196: client.onreadystatechange = handler;
197: client.open("GET", "test.xml");
198: client.send();</pre>
1.16 avankest 199:
1.14 avankest 200: <p>If you just want to ping the server with a message you could do something
1.22 ! avankest 201: like:</p>
1.16 avankest 202:
1.14 avankest 203: <pre>function ping(message) {
204: var client = new XMLHttpRequest();
205: client.open("POST", "/ping");
206: client.send(message);
207: }</pre>
1.16 avankest 208:
1.14 avankest 209: <p>Or if you want to check the status of a document on the server:</p>
1.16 avankest 210:
1.14 avankest 211: <pre>function fetchStatus(address) {
212: var client = new XMLHttpRequest();
213: client.onreadystatechange = function() {
214: // in case of network errors this might not give reliable results
215: if(this.readyState == 4)
216: returnStatus(this.status);
217: }
218: client.open("HEAD", address);
219: client.send();
220: }</pre>
221: </div>
1.12 avankest 222:
1.14 avankest 223: <!-- XXX: perhaps fetch some more examples from the web... -->
1.16 avankest 224:
1.1 avankest 225: <h3 id="conformance">Conformance</h3>
1.12 avankest 226:
1.1 avankest 227: <p>Everying in this specification is normative except for diagrams, examples,
1.22 ! avankest 228: notes and sections marked non-normative.</p>
1.12 avankest 229:
1.1 avankest 230: <p>The key words <em class="ct">must</em>, <em class="ct">must not</em>,
1.22 ! avankest 231: <em class="ct">required</em>, <em class="ct">shall</em>, <em class="ct">shall
! 232: not</em>, <em class="ct">should</em>, <em class="ct">should not</em>,
! 233: <em class="ct">recommended</em>, <em class="ct">may</em> and
! 234: <em class="ct">optional</em> in this document are to be interpreted as
! 235: described in RFC 2119 [<cite><a href="#RFC2119">RFC2119</a></cite>].</p>
1.12 avankest 236:
1.1 avankest 237: <p>This specification defines the following classes of products:</p>
1.12 avankest 238:
1.1 avankest 239: <dl>
240: <dt><dfn>conforming implementation</dfn></dt>
1.22 ! avankest 241:
1.8 avankest 242: <dd>A user agent that implements all interfaces described in this
1.22 ! avankest 243: specification and follows all <em class="ct">must</em>-,
! 244: <em class="ct">required</em>- and <em class="ct">shall</em>-level of critera
! 245: in this specification.</dd>
! 246:
1.1 avankest 247: <dt><dfn>conforming document</dfn></dt>
1.22 ! avankest 248:
1.1 avankest 249: <dd>A document that follows all <em class="ct">must</em>-,
1.22 ! avankest 250: <em class="ct">required</em>- and <em class="ct">shall</em>-level of critera
! 251: in this specification that apply to document authors.</dd>
! 252:
1.1 avankest 253: <dt><dfn>conforming authoring tool</dfn></dt>
1.22 ! avankest 254:
1.1 avankest 255: <dd>One that produces conforming documents.</dd>
256: </dl>
1.12 avankest 257:
1.1 avankest 258: <h3 id="extensibility">Extensibility</h3>
1.12 avankest 259:
260: <p><em>This section is non-normative.</em></p>
261:
262: <p>Extensions of the APIs defined in this specification are <em>strongly
1.22 ! avankest 263: discouraged</em>. User agents, Working Groups and other interested parties
! 264: should discuss extensions on a relevant public forum, such as
! 265: <a href="mailto:public-webapi@w3.org">public-webapi@w3.org</a>.</p>
1.12 avankest 266:
1.1 avankest 267: <h3 id="notcovered">Not in this Specification</h3>
1.12 avankest 268:
1.8 avankest 269: <p><em>This section is non normative.</em></p>
1.12 avankest 270:
1.1 avankest 271: <p>This specification does not include the following features that may or may
1.22 ! avankest 272: not be implemented by user agents:</p>
1.12 avankest 273:
1.1 avankest 274: <ul>
275: <li><code>load</code> event and <code>onload</code> attribute;</li>
276: <li><code>error</code> event and <code>onerror</code> attribute;</li>
277: <li><code>progress</code> event and <code>onprogress</code> attribute;</li>
1.14 avankest 278: <li><code title="">abort</code> event and <code>onabort</code> attribute;</li>
1.1 avankest 279: <li>Timers have been suggested, perhaps an <code>ontimeout</code>
280: attribute;</li>
281: <li>Property to disable following redirects;</li>
282: <li><code>responseXML</code> for <code>text/html</code> documents;</li>
283: <li>Cross-site <code>XMLHttpRequest</code>.</li>
284: </ul>
1.12 avankest 285:
286: <h2 id="xmlhttprequest">The <code title="">XMLHttpRequest</code> Object</h2>
287:
1.13 avankest 288: <p class="issue">What if the user cancels a request by leaving the page? How
1.22 ! avankest 289: does that work for multiple windows and what's the effect on the object? Need
! 290: to test.</p>
1.13 avankest 291:
1.1 avankest 292: <p>The <code>XMLHttpRequest</code> interface may be used to allow scripts to
1.22 ! avankest 293: programmatically connect to their originating server via HTTP.</p>
1.12 avankest 294:
1.1 avankest 295: <p>Objects implementing the <code>XMLHttpRequest</code> interface
1.22 ! avankest 296: <em class="ct">must</em> also implement the <code>EventTarget</code>
! 297: interface [<cite><a href="#DOM3EV">DOM3Events</a></cite>].</p>
1.12 avankest 298:
1.14 avankest 299: <p>In [<cite><a href="#ref-ecmascript">ECMAScript</a></cite>], an instance of
1.22 ! avankest 300: <code>XMLHttpRequest</code> can be created using the
! 301: <code title="">XMLHttpRequest()</code> constructor:</p>
1.12 avankest 302:
1.1 avankest 303: <div class="example">
304: <pre>var client = new XMLHttpRequest();</pre>
305: </div>
1.12 avankest 306:
1.21 avankest 307: <p>When the constructor is invoked the <dfn><code>XMLHttpRequest</code> base
1.22 ! avankest 308: resource identifier reference</dfn> <em class="ct">must</em> be set to the
! 309: value of the <code>baseURI</code> attribute of the <code>Document</code>
! 310: object that's associated with the <code>Window</code> object which initially
! 311: had <code title="">XMLHttpRequest</code> as an attribute of which the
! 312: constructor was invoked. When <code>baseURI</code> is <code>null</code> there
! 313: is no <span><code>XMLHttpRequest</code> base resource identifier
! 314: reference</span>.</p>
1.12 avankest 315:
1.21 avankest 316: <h3 id="xmlhttprequest-members">Members of the <code>XMLHttpRequest</code>
1.22 ! avankest 317: Object</h3>
1.12 avankest 318:
1.1 avankest 319: <p>A more complete description of what can be done with
1.22 ! avankest 320: <code>XMLHttpRequest</code> can be found in the non-normative
! 321: <abbr title="Interface Definition Language">IDL</abbr> below and its
! 322: associated details.</p>
1.12 avankest 323:
1.1 avankest 324: <pre class="idl">interface <dfn>XMLHttpRequest</dfn> {
1.7 avankest 325: attribute EventListener <span>onreadystatechange</span>;
1.1 avankest 326: readonly attribute unsigned short <span>readyState</span>;
1.12 avankest 327: void <span>open</span>(in DOMString <var>method</var>, in DOMString <var>url</var>);
328: void <span>open</span>(in DOMString <var>method</var>, in DOMString <var>url</var>, in boolean <var>async</var>);
329: void <span>open</span>(in DOMString <var>method</var>, in DOMString <var>url</var>, in boolean <var>async</var>, in DOMString <var>user</var>);
330: 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>);
1.3 avankest 331: void <span>setRequestHeader</span>(in DOMString <var>header</var>, in DOMString <var>value</var>);
1.1 avankest 332: void <span>send</span>();
1.3 avankest 333: void <span>send</span>(in DOMString <var>data</var>);
334: void <span>send</span>(in Document <var>data</var>);
1.1 avankest 335: void <span>abort</span>();
336: DOMString <span>getAllResponseHeaders</span>();
1.3 avankest 337: DOMString <span>getResponseHeader</span>(in DOMString <var>header</var>);
1.7 avankest 338: readonly attribute DOMString <span>responseText</span>;
339: readonly attribute Document <span>responseXML</span>;
340: readonly attribute unsigned short <span>status</span>;
341: readonly attribute DOMString <span>statusText</span>;
1.1 avankest 342: };</pre>
1.8 avankest 343:
1.5 avankest 344: <dl>
1.12 avankest 345:
1.22 ! avankest 346: <dt><dfn id="dfn-onreadystatechange"><code>onreadystatechange</code></dfn> of
! 347: type <code>EventListener</code></dt>
1.12 avankest 348:
1.1 avankest 349: <dd>
350: <p>An attribute that takes an <code>EventListener</code> as value that
1.22 ! avankest 351: <em class="ct">must</em> be invoked when <code>readystatechange</code> is
! 352: dispatched on the object implementing the <code>XMLHttpRequest</code>
! 353: interface. Its initial value <em class="ct">must</em> be
! 354: <code>null</code>.</p>
1.1 avankest 355: </dd>
1.12 avankest 356:
1.1 avankest 357: <dt><dfn id="dfn-readystate"><code>readyState</code></dfn> of type
1.22 ! avankest 358: <code>unsigned short</code>, readonly</dt>
1.12 avankest 359:
1.1 avankest 360: <dd>
361: <p>The state of the object. The attribute <em class="ct">must</em> be one of
1.22 ! avankest 362: the following values:</p>
1.12 avankest 363:
1.1 avankest 364: <dl>
365: <dt>0 Uninitialized</dt>
1.22 ! avankest 366:
1.1 avankest 367: <dd>The initial value.</dd>
1.22 ! avankest 368:
1.1 avankest 369: <dt>1 Open</dt>
1.22 ! avankest 370:
1.1 avankest 371: <dd>The <code>open()</code> method has been successfully called.</dd>
1.22 ! avankest 372:
1.1 avankest 373: <dt>2 Sent</dt>
1.22 ! avankest 374:
1.15 avankest 375: <dd>The user agent successfully acknowledged the request.</dd>
1.22 ! avankest 376:
1.1 avankest 377: <dt>3 Receiving</dt>
1.22 ! avankest 378:
1.1 avankest 379: <dd>Immediately before receiving the message body (if any). All HTTP
1.22 ! avankest 380: headers have been received.</dd>
! 381:
1.1 avankest 382: <dt>4 Loaded</dt>
1.22 ! avankest 383:
1.1 avankest 384: <dd>The data transfer has been completed.</dd>
385: </dl>
1.21 avankest 386:
387: <p class="note">When <code>readyState</code> changes value a
1.22 ! avankest 388: <code>readystatechange</code> event is to be dispatched on the
! 389: <code>XMLHttpRequest</code> object.</p>
1.1 avankest 390: </dd>
1.12 avankest 391:
1.14 avankest 392: <dt><dfn id="dfn-open" title="open"><code>open(<var>method</var>,
1.22 ! avankest 393: <var>url</var>, <var>async</var>, <var>user</var>,
! 394: <var>password</var>)</code></dfn>, method</dt>
1.12 avankest 395:
1.1 avankest 396: <dd>
1.17 avankest 397: <p class="issue">What about multiple <code>open()</code> invocations? Like
1.22 ! avankest 398: behind each other or one after invoking <code>send()</code>, etc.</p>
1.17 avankest 399:
1.22 ! avankest 400: <p class="issue">Need to make it more clear what <code>null</code> means for
! 401: <var>user</var> and <var>password</var>.</p>
! 402:
1.1 avankest 403: <p>Calling this method <em class="ct">must</em> initialize the object by
1.22 ! avankest 404: remembering the <var>method</var>, <var>url</var>, <var>async</var>
! 405: (defaulting to <code>true</code> if omitted), <var>user</var> (defaulting
! 406: to <code>null</code> if omitted), and <var>password</var> (defaulting to
! 407: <code>null</code> if omitted) arguments, setting the
! 408: <code>readyState</code> attribute to 1 (Open), resetting the
! 409: <code>responseText</code>, <code>responseXML</code>, <code>status</code>,
! 410: and <code>statusText</code> attributes to their initial values, and
! 411: resetting the list of request headers.</p>
1.12 avankest 412:
1.13 avankest 413: <p>If the <var>method</var> argument doesn't match the <dfn>method
1.22 ! avankest 414: production</dfn> defined in section 5.1.1 of
! 415: [<cite><a href="#RFC2616">RFC2616</a></cite>] a <code>SYNTAX_ERR</code>
! 416: <em class="ct">must</em> be raised by the user agent. If the user agent
! 417: doesn't support the given method for security reasons a
! 418: <code>SECURITY_ERR</code> <em class="ct">should</em> be raised.</p>
1.14 avankest 419:
1.13 avankest 420: <p>User agents <em class="ct">must</em> at least support the following list
1.22 ! avankest 421: of methods (see [<cite><a href="#RFC2616">RFC2616</a></cite>]):</p>
1.14 avankest 422:
1.13 avankest 423: <ul>
424: <li><code>GET</code></li>
425: <li><code>POST</code></li>
426: <li><code>HEAD</code></li>
427: <li><code>PUT</code></li>
428: <li><code>DELETE</code></li>
429: </ul>
1.16 avankest 430:
1.13 avankest 431: <p>User agents <em class="ct">should</em> support any <var>method</var>
1.22 ! avankest 432: argument that matches the <span>method production</span>.</p>
1.14 avankest 433:
1.13 avankest 434: <p>When <var>method</var> case-insensitively matches <code>GET</code>,
1.22 ! avankest 435: <code>POST</code>, <code>HEAD</code>, <code>PUT</code> or
! 436: <code>DELETE</code> the user agent <em class="ct">must</em> use the
! 437: uppercase equivalent instead.</p>
1.12 avankest 438:
1.21 avankest 439:
440: <p>When <var>url</var> is a relative reference, it <em class="ct">must</em>
1.22 ! avankest 441: be resolved using <span><code>XMLHttpRequest</code> base resource
! 442: identifier reference</span>. If that's not defined, or there's a failure in
! 443: resolving user agents <em class="ct">must</em> throw a
! 444: <code>SYNTAX_ERR</code>. When a non same-origin <var>url</var> argument is
! 445: given user agents <em class="ct">should</em> throw a
! 446: <code>SECURITY_ERR</code> exception.</p>
1.21 avankest 447:
448: <p class="issue">What happens with fragment identifiers? Do we need to say
1.22 ! avankest 449: anything special about same-document references?</p>
1.14 avankest 450:
1.19 avankest 451: <p class="note">A future version or extension of this specification will
1.22 ! avankest 452: define a way of doing cross-site requests.</p>
1.21 avankest 453:
454: <!--<p>If the <var>url</var> parameter doesn't match the syntax defined in
455: section 3.2.2 of [<cite><a href="#RFC2616">RFC2616</a></cite>] a
456: <code>SYNTAX_ERR</code> <em class="ct">must</em> be raised.</p>-->
457:
1.17 avankest 458: <p>User agents <em class="ct">should not</em> support the "user:password"
1.22 ! avankest 459: format in the <code>userinfo</code> production defined in section 3.2.1 of
! 460: [<cite><a href="#ref-rfc3986">RFC3986</a></cite>] and
! 461: <em class="ct">must</em> throw a <code>SYNTAX_ERR</code> when doing so (not
! 462: supporting it). When they do support it, or in case of people using the
! 463: format "user", user agents <em class="ct">must</em> use them if the
! 464: <var>user</var> and <var>password</var> arguments are omitted. If the
! 465: arguments are not omitted, they take precedence, even if they are
! 466: <code>null</code>.</p>
1.17 avankest 467:
468: <p>If the <var>user</var> argument doesn't match the
1.22 ! avankest 469: <code>username-value</code> production defined in section 3.2.2 of
! 470: [<cite><a href="#ref-rfc2617">RFC2617</a></cite>] user agents
! 471: <em class="ct">must</em> throw a <code>SYNTAX_ERR</code> exception.</p>
! 472:
! 473: <p class="issue">Need to look at the <var>password</var> argument. What
! 474: syntax does it need to match. Can it be UTF-8 on transmission? When it's
! 475: omitted, do UAs still use the user argument? IE doesn't.</p>
1.14 avankest 476:
1.13 avankest 477: <p>If <code>open()</code> is invoked when <code>readyState</code> is 4
1.22 ! avankest 478: (Loaded) all members of the object <em class="ct">must</em> be set to their
! 479: initial values.</p>
1.14 avankest 480:
1.1 avankest 481: </dd>
1.12 avankest 482:
1.14 avankest 483: <dt><dfn id="dfn-setrequestheader" title="setrequestheader"><code>setRequestHeader(<var>header</var>,
1.22 ! avankest 484: <var>value</var>)</code></dfn>, method</dt>
1.12 avankest 485:
1.5 avankest 486: <dd>
487: <p>The nominated request header (<var>header</var>) field value
1.22 ! avankest 488: <em class="ct">must</em> be set to <var>value</var>, with the following
! 489: exceptions:</p>
1.14 avankest 490:
1.5 avankest 491: <ul>
492: <li>If the <code>readyState</code> attribute has a value other than 1
1.22 ! avankest 493: (Open) or the <span><code>send()</code> flag</span> is set an
! 494: <code>INVALID_STATE_ERR</code> exception <em class="ct">must</em> be
! 495: raised;</li>
1.14 avankest 496:
1.13 avankest 497: <li>If the <var>header</var> argument doesn't match the
1.22 ! avankest 498: <dfn><code>field-name</code> production</dfn> as defined by section 4.2
! 499: of [<cite><a href="#RFC2616">RFC2616</a></cite>] a <code>SYNTAX_ERR</code>
! 500: <em class="ct">must</em> be raised;</li>
1.14 avankest 501:
1.13 avankest 502: <li>If the <var>value</var> argument doesn't match the
1.22 ! avankest 503: <dfn><code>field-value</code> production</dfn> as defined by section 4.2
! 504: of [<cite><a href="#RFC2616">RFC2616</a></cite>] a <code>SYNTAX_ERR</code>
! 505: <em class="ct">must</em> be raised;</li>
1.14 avankest 506:
1.13 avankest 507: <li>For security reasons nothing <em class="ct">should</em> be done if the
1.22 ! avankest 508: <var>header</var> argument matches <code>Accept-Charset</code>,
! 509: <code>Accept-Encoding</code>, <code>Content-Length</code>,
! 510: <code>Expect</code>, <code>Date</code>, <code>Host</code>,
! 511: <code>Keep-Alive</code>, <code>Referer</code>, <code>TE</code>,
! 512: <code>Trailer</code>, <code>Transfer-Encoding</code> or
! 513: <code>Upgrade</code> case-insensitively.</li>
! 514:
! 515: <!-- XXX or should this throw an exception? -->
1.5 avankest 516: </ul>
517:
518: <p>Implementations <em class="ct">must</em> replace any existing value if
1.22 ! avankest 519: the nominated request header field value is one of:
! 520: <code>Authorization</code>, <code>Content-Base</code>,
! 521: <code>Content-Location</code>, <code>Content-MD5</code>,
! 522: <code>Content-Range</code>, <code>Content-Type</code>,
! 523: <code>Content-Version</code>, <code>Delta-Base</code>, <code>Depth</code>,
! 524: <code>Destination</code>, <code>ETag</code>, <code>Expect</code>,
! 525: <code>From</code>, <code>If-Modified-Since</code>, <code>If-Range</code>,
! 526: <code>If-Unmodified-Since</code>, <code>Max-Forwards</code>,
! 527: <code>MIME-Version</code>, <code>Overwrite</code>,
! 528: <code>Proxy-Authorization</code>, <code>SOAPAction</code> or
! 529: <code>Timeout</code>.</p>
1.14 avankest 530:
1.5 avankest 531: <p>Otherwise, if the nominated request header field already has a value, the
1.22 ! avankest 532: new value <em class="ct">must</em> be combined with the existing value
! 533: (section 4.2, [<cite><a href="#RFC2616">RFC2616</a></cite>]). See also the
! 534: <code>send()</code> method regarding user agent header handling for caching,
! 535: authentication, proxies, and cookies.</p>
1.14 avankest 536:
537: <div class="example">
538: <pre>// The following script:
539: var client = new XMLHttpRequest();
540: client.open('GET', 'demo.cgi');
541: client.setRequestHeader('X-Test', 'one');
542: client.setRequestHeader('X-Test', 'two');
543: client.send();
544:
545: // ...would result in the following header being sent:
546: ...
547: X-Test: one, two
548: ...</pre>
549: </div>
550:
1.13 avankest 551: <p>The list of request headers <em class="ct">must</em> be reset when the
1.22 ! avankest 552: <code>open()</code> method is invoked.</p>
1.5 avankest 553: </dd>
1.12 avankest 554:
1.14 avankest 555: <dt><dfn id="dfn-send" title="send"><code>send(<var>data</var>)</code></dfn>,
1.22 ! avankest 556: method</dt>
1.12 avankest 557:
1.17 avankest 558: <dd>
1.20 avankest 559: <p>If the <code>readyState</code> attribute has a value other than 1 (Open)
1.22 ! avankest 560: or the <span><code>send()</code> flag</code> is set an
! 561: <code>INVALID_STATE_ERR</code> exception <em class="ct">must</em> be
! 562: raised. Otherwise user agents <em class="ct">must</em> make a request to
! 563: <var>url</var> using method <var>method</var> and set the
! 564: <dfn><code>send()</code> flag</dfn>. If the <var>async</var> flag is set to
! 565: <code>false</code>, then the method <em class="ct">must not</em> return
! 566: until the request has completed. Otherwise, it <em class="ct">must</em>
! 567: return immediately. (See: <code>open()</code>.)</p>
1.21 avankest 568:
1.20 avankest 569: <p class="note">The <span><code>send()</code> flag</span> is only relevant
1.22 ! avankest 570: when <code>readyState</code> is 1 (Open).</p>
1.12 avankest 571:
572: <p>If <var>data</var> is passed to the <code>send()</code> method it
1.22 ! avankest 573: <em class="ct">must</em> be used for the entity body following these rules
! 574: (the term <dfn id="dfn-entity-body">entity body</dfn> is defined by section
! 575: 7.2.1 of [<cite><a href="#RFC2616">RFC2616</a></cite>]):</p>
1.12 avankest 576:
1.1 avankest 577: <ul>
578: <li>If <var>data</var> is a <code>DOMString</code>, it
1.22 ! avankest 579: <em class="ct">must</em> be encoded as UTF-8 for transmission.</li>
! 580:
1.1 avankest 581: <li>If the <var>data</var> is a <code>Document</code>, it
1.22 ! avankest 582: <em class="ct">must</em> be serialized using the encoding given by
! 583: <code><var>data</var>.xmlEncoding</code>, if specified and supported, or
! 584: UTF-8 otherwise [<cite><a href="#DOM3">DOM3Core</a></cite>].</li>
! 585:
1.1 avankest 586: <li>If <var>data</var> is not a <code>DOMString</code> or a
1.22 ! avankest 587: <code>Document</code> the host language its stringification mechanisms
! 588: <em class="ct">must</em> be used on the argument that was passed and the
! 589: result <em class="ct">must</em> be treated as if <var>data</var> is a
! 590: <code>DOMString</code>.</li>
1.1 avankest 591: </ul>
1.12 avankest 592:
1.16 avankest 593: <p>Invoking <code>send()</code> without the <var>data</var> argument
1.22 ! avankest 594: <em class="ct">must</em> give the same result as if it was invoked with
! 595: <code>null</code> as argument.</p>
1.12 avankest 596:
597: <p>Authors <em class="ct">should</em> specify the <code>Content-Type</code>
1.22 ! avankest 598: header via <code>setRequestHeader</code> before invoking
! 599: <code>send()</code> with an argument. If the argument to
! 600: <code>send()</code> is a <code>Document</code> and no
! 601: <code>Content-Type</code> header has been set user agents
! 602: <em class="ct">must</em> set it to <code>application/xml</code> for XML
! 603: documents and to the most appropriate media type for other documents (using
! 604: intrinsic knowledge about the document).</p>
1.12 avankest 605:
1.14 avankest 606: <p>If the response is an HTTP redirect (status code <code>301</code>,
1.22 ! avankest 607: <code>302</code>, <code>303</code> or <code>307</code>), then it
! 608: <em class="ct">must</em> be transparently followed (unless it violates
! 609: security, infinite loop precautions or the scheme isn't supported). Note
! 610: that HTTP ([<cite><a href="#RFC2616">RFC2616</a></cite>]) places
! 611: requirements on user agents regarding the preservation of the request
! 612: method during redirects, and also requires users to be notified of certain
! 613: kinds of automatic redirections.</p>
1.12 avankest 614:
1.15 avankest 615: <p>Once the request has been successfully acknowledged
1.22 ! avankest 616: <code>readyState</code> <em class="ct">must</em> be set to 2 (Sent).
! 617: Immediately before receiving the message body (if any), the
! 618: <code>readyState</code> attribute <em class="ct">must</em> be set to to 3
! 619: (Receiving). When the request has completed loading, the
! 620: <code>readyState</code> attribute <em class="ct">must</em> be set to 4
! 621: (Loaded). In case of a <code>HEAD</code> request <code>readyState</code>
! 622: <em class="ct">must</em> be set to 4 (Loaded) immediately after having gone
! 623: to 3 (Receiving).</p>
1.16 avankest 624:
1.15 avankest 625: <p>If something goes wrong (infinite loop, network errors) the
1.22 ! avankest 626: <code>readyState</code> attribute <em class="ct">must</em> be set to 4
! 627: (Loaded) and all other members of the object <em class="ct">must</em> be set
! 628: to their initial value. Besides that, all registered event listeners
! 629: <em class="ct">must</em> be removed.</p>
1.16 avankest 630:
1.15 avankest 631: <p class="note">In future versions of this specification user agents will be
1.22 ! avankest 632: required to dispatch an <code>error</code> event if the above occurs.</p>
1.14 avankest 633:
1.8 avankest 634: <p>If the user agent allows the specification of a proxy it
1.22 ! avankest 635: <em class="ct">should</em> modify the request appropriately;
! 636: <abbr title="in other words">i.e.</abbr>, connect to the proxy host instead
! 637: of the origin server, modify the <code>Request-Line</code> and send
! 638: <code>Proxy-Authorization</code> headers as specified.</p>
1.12 avankest 639:
1.14 avankest 640: <p>If the user agent supports <cite>HTTP Authentication</cite>
1.22 ! avankest 641: ([<cite><a href="#ref-rfc2617">RFC2617</a></cite>]) it
! 642: <em class="ct">should</em> consider requests originating from this object
! 643: to be part of the protection space that includes the accessed URIs and send
! 644: <code>Authorization</code> headers and handle <code>401 Unauthorised</code>
! 645: requests appropriately. if authentication fails, user agents
! 646: <em class="ct">should</em> prompt the users for credentials.</p>
1.12 avankest 647:
1.14 avankest 648: <p>If the user agent supports <cite>HTTP State Mangement</cite>
1.22 ! avankest 649: ([<cite><a href="#ref-rfc2109">RFC2109</a></cite>],
! 650: [<cite><a href="#ref-rfc2965">RFC2965</a></cite>]) it
! 651: <em class="ct">should</em> persist, discard and send cookies (as received in
! 652: the <code>Set-Cookie</code> and <code>Set-Cookie2</code> response headers,
! 653: and sent in the <code>Cookie</code> header) as applicable.</p>
1.12 avankest 654:
1.8 avankest 655: <p>If the user agent implements a HTTP cache
1.22 ! avankest 656: ([<cite><a href="#RFC2616">RFC2616</a></cite>]) it
! 657: <em class="ct">should</em> respect <code>Cache-Control</code> request
! 658: headers set by the author (<abbr title="for example">e.g.</abbr>,
! 659: <code>Cache-Control: no-cache</code> bypasses the cache). It
! 660: <em class="ct">must not</em> send <code>Cache-Control</code> or
! 661: <code>Pragma</code> request headers automatically unless the user explicitly
! 662: requests such behaviour (e.g., by (force-)reloading the page). <code>304 Not
! 663: Modified</code> responses that are a result of a user agent generated
! 664: conditional request <em class="ct">must</em> be presented as <code>200
! 665: OK</code> responses with the appropriate content. Such user agents
! 666: <em class="ct">must</em> allow authors to override automatic cache
! 667: validation by setting request headers (e.g., <code>If-None-Match</code>,
! 668: <code>If-Modified-Since</code>), in which case <code>304 Not Modified</code>
! 669: responses <em class="ct">must</em> be passed through.</p>
1.12 avankest 670:
1.8 avankest 671: <p>If the user agent implements server-driven content-negotiation
1.22 ! avankest 672: ([<cite><a href="#RFC2616">RFC2616</a></cite>]) it
! 673: <em class="ct">should</em> set <code>Accept-Language</code>,
! 674: <code>Accept-Encoding</code> and <code>Accept-Charset</code> headers as
! 675: appropriate; it <em class="ct">must not</em> automatically set the
! 676: <code>Accept</code> header. Responses to such requests
! 677: <em class="ct">must</em> have content-codings automatically removed.</p>
1.14 avankest 678:
679: <p>If the user agent supports Expect/Continue for request bodies
1.22 ! avankest 680: ([<cite><a href="#RFC2616">RFC2616</a></cite>]) it
! 681: <em class="ct">should</em> insert <code>Expect</code> headers and handle
! 682: <code>100 Continue</code> responses appropriately.</p>
1.8 avankest 683: </dd>
1.12 avankest 684:
1.14 avankest 685: <dt><dfn id="dfn-abort"><code>abort()</code></dfn>, method</dt>
1.12 avankest 686:
1.5 avankest 687: <dd>
688: <p>When invoked, this method <em class="ct">must</em> cancel any network
1.22 ! avankest 689: activity for which the object is responsible and set all the members of the
! 690: object to their initial values.</p>
1.5 avankest 691: </dd>
1.12 avankest 692:
1.14 avankest 693: <dt><dfn id="dfn-getallresponseheaders"><code>getAllResponseHeaders()</code></dfn>,
1.22 ! avankest 694: method</dt>
1.12 avankest 695:
1.5 avankest 696: <dd>
697: <p>If the <code>readyState</code> attribute has a value other than 3
1.22 ! avankest 698: (Receiving) or 4 (Loaded), user agents <em class="ct">must</em> raise an
! 699: <code>INVALID_STATE_ERR</code> exception. Otherwise, it
! 700: <em class="ct">must</em> return all the HTTP headers, as a single string,
! 701: with each header line separated by a CR (U+000D) LF (U+000A) pair. The
! 702: status line <em class="ct">must not</em> be included.</p>
! 703:
1.5 avankest 704: <div class="example">
705: <pre>// The following script:
706: var client = new XMLHttpRequest();
1.14 avankest 707: client.open("GET", "test.txt", true);
1.5 avankest 708: client.send();
1.12 avankest 709: client.onreadystatechange = function() {
1.13 avankest 710: if(this.readyState == 3) {
1.12 avankest 711: print(this.getAllResponseHeaders());
712: }
713: }
1.5 avankest 714:
715: // ...should output something similar to the following text:
716: Date: 2004年10月24日 04:58:38 GMT
717: Server: Apache/1.3.31 (Unix)
718: Keep-Alive: timeout=15, max=99
719: Connection: Keep-Alive
720: Transfer-Encoding: chunked
721: Content-Type: text/plain; charset=utf-8</pre>
722: </div>
723: </dd>
1.12 avankest 724:
1.18 avankest 725: <dt><dfn id="dfn-getresponseheader" title="getresponseheader"><code>getResponseHeader(<var>header</var>)</code></dfn>,
1.22 ! avankest 726: method</dt>
1.12 avankest 727:
1.1 avankest 728: <dd>
1.13 avankest 729: <p>If the <var>header</var> argument doesn't match the
1.22 ! avankest 730: <span><code>field-name</code> production</span> a <code>SYNTAX_ERR</code>
! 731: <em class="ct">must</em> be raised. Otherwise this method works as described
! 732: below.</p>
1.14 avankest 733:
1.5 avankest 734: <p>If the <code>readyState</code> attribute has a value other than 3
1.22 ! avankest 735: (Receiving) or 4 (Loaded), the user agent <em class="ct">must</em> raise an
! 736: <code>INVALID_STATE_ERR</code> exception. Otherwise, it
! 737: <em class="ct">must</em> represent the value of the given HTTP header
! 738: (<var>header</var>) in the data received so far for the last request sent,
! 739: as a single string. If more than one header of the given name was received,
! 740: then the values <em class="ct">must</em> be concatenated, separated from
! 741: each other by an U+002C COMMA followed by an U+0020 SPACE. If no headers of
! 742: that name were received, then it <em class="ct">must</em> return
! 743: <code>null</code>. Header names <em class="ct">must</em> be compared
! 744: case-insensitively to the method its argument (<var>header</var>).</p>
1.12 avankest 745:
1.1 avankest 746: <div class="example">
747: <pre>// The following script:
748: var client = new XMLHttpRequest();
1.14 avankest 749: client.open("GET", "test.txt", true);
1.5 avankest 750: client.send();
1.12 avankest 751: client.onreadystatechange = function() {
1.13 avankest 752: if(this.readyState == 3) {
1.14 avankest 753: print(client.getResponseHeader("Content-Type"));
1.12 avankest 754: }
755: }
1.1 avankest 756:
1.5 avankest 757: // ...should output something similar to the following text:
758: Content-Type: text/plain; charset=utf-8</pre>
1.1 avankest 759: </div>
1.5 avankest 760: </dd>
1.12 avankest 761:
1.5 avankest 762: <dt><dfn id="dfn-responsetext"><code>responseText</code></dfn> of type
1.22 ! avankest 763: <code>DOMString</code>, readonly</dt>
1.12 avankest 764:
1.5 avankest 765: <dd>
766: <p>If the <code>readyState</code> attribute has a value other than 3
1.22 ! avankest 767: (Receiving) or 4 (Loaded), the user agent <em class="ct">must</em> raise an
! 768: <code>INVALID_STATE_ERR</code> exception. Otherwise, it
! 769: <em class="ct">must</em> be the fragment of the <span>entity body</span>
! 770: received so far (when <code>readyState</code> is 3 (Receiving)) or the
! 771: complete <span>entity body</span> (when <code>readyState</code> is 4
! 772: (Loaded)), interpreted as a stream of characters.</p>
1.12 avankest 773:
774: <p>If the response includes a <code>Content-Type</code> understood by the
1.22 ! avankest 775: user agent the characters are encoded following the relevant media type
! 776: specification, with the exception that the rule in the final paragraph of
! 777: section 3.7.1 of [<cite><a href="#RFC2616">RFC2616</a></cite>], and the
! 778: rules in section 4.1.2 of [<cite><a href="#ref-rfc2046">RFC2046</a></cite>]
! 779: <em class="ct">must</em> be treated as if they specified the default
! 780: character encoding as being UTF-8. Invalid bytes <em class="ct">must</em> be
! 781: converted to U+FFFD REPLACEMENT CHARACTER. If the user agent can't derive a
! 782: character stream in accord with the media type specification,
! 783: <code>reponseText</code> <em class="ct">must</em> be <code>null</code>.</p>
1.12 avankest 784:
785: <p>Its initial value <em class="ct">must</em> be the <code>null</code>.</p>
1.21 avankest 786:
1.20 avankest 787: <p class="note">For <code>HEAD</code> requests for example, this attribute
1.22 ! avankest 788: will always be <code>null</code> (it remains unchanged). Similar to the
! 789: <code>responseXML</code> attribute.</p>
1.5 avankest 790: </dd>
1.12 avankest 791:
1.5 avankest 792: <dt><dfn id="dfn-responsexml"><code>responseXML</code></dfn> of type
1.22 ! avankest 793: <code>Document</code>, readonly</dt>
1.12 avankest 794:
1.8 avankest 795: <dd>
796: <p>If the <code>readyState</code> attribute has a value other than 4
1.22 ! avankest 797: (Loaded), user agents <em class="ct">must</em> raise an
! 798: <code>INVALID_STATE_ERR</code> exception. Otherwise, if the
! 799: <code>Content-Type</code> header contains a media type (ignoring any
! 800: parameters) that is either <code>text/xml</code>,
! 801: <code>application/xml</code>, or ends in <code>+xml</code>, it
! 802: <em class="ct">must</em> be an object that implements the
! 803: <code>Document</code> interface representing the parsed document. If
! 804: <code>Content-Type</code> did not contain such a media type, or if the
! 805: document could not be parsed (due to an XML well-formedness error or
! 806: unsupported character encoding, for instance), it <em class="ct">must</em>
! 807: be <code>null</code>.</p>
1.12 avankest 808:
1.8 avankest 809: <p>Its initial value <em class="ct">must</em> be <code>null</code>.</p>
1.5 avankest 810: </dd>
1.12 avankest 811:
1.22 ! avankest 812: <dt><dfn id="dfn-status"><code>status</code></dfn> of type <code>unsigned
! 813: short</code>, readonly</dt>
1.12 avankest 814:
1.5 avankest 815: <dd>
816: <p>If the <code>status</code> attribute is not available an
1.22 ! avankest 817: <code>INVALID_STATE_ERR</code> exception <em class="ct">must</em> be raised.
! 818: It <em class="ct">must</em> be available when <code>readyState</code> is 3
! 819: (Receiving) or 4 (Loaded). When available, it <em class="ct">must</em>
! 820: represent the HTTP status code (typically <code>200</code> for a successful
! 821: connection).</p>
1.12 avankest 822:
1.8 avankest 823: <p>Its initial value <em class="ct">must</em> be <code>0</code>.</p>
1.12 avankest 824: </dd>
825:
1.5 avankest 826: <dt><dfn id="dfn-statustext"><code>statusText</code></dfn> of type
1.22 ! avankest 827: <code>DOMString</code>, readonly</dt>
1.12 avankest 828:
1.5 avankest 829: <dd>
830: <p>If the <code>statusText</code> attribute is not available an
1.22 ! avankest 831: <code>INVALID_STATE_ERR</code> exception <em class="ct">must</em> be raised.
! 832: It <em class="ct">must</em> be available when <code>readyState</code> is 3
! 833: (Receiving) or 4 (Loaded). When available, it <em class="ct">must</em>
! 834: represent the HTTP status text sent by the server (appears after the status
! 835: code).</p>
1.21 avankest 836:
1.8 avankest 837: <p>Its initial value <em class="ct">must</em> be the empty string.</p>
1.1 avankest 838: </dd>
839: </dl>
1.12 avankest 840:
1.1 avankest 841: <p>HTTP requests sent from multiple different <code>XMLHttpRequest</code>
1.22 ! avankest 842: objects in succession <em class="ct">should</em> be pipelined into shared HTTP
! 843: connections.</p>
1.12 avankest 844:
1.10 avankest 845: <h3 id="events">Events for the <code>XMLHttpRequest</code> Object</h3>
1.12 avankest 846:
1.1 avankest 847: <p>These sections describe the various events that can be dispatched on the
1.22 ! avankest 848: object implementing the <code>XMLHttpRequest</code> interface. For this
! 849: version of the specification only one event is defined.</p>
1.12 avankest 850:
1.1 avankest 851: <dl>
852: <dt><dfn id="dfn-readystatechange"><code>readystatechange</code></dfn></dt>
1.22 ! avankest 853:
1.1 avankest 854: <dd>The <code>readystatechange</code> event <em class="ct">must</em> be
1.22 ! avankest 855: dispatched when <code>readyState</code> changes value. It <em class="ct">must
! 856: not</em> bubble, <em class="ct">must not</em> be cancelable and
! 857: <em class="ct">must</em> implement the <code>Event</code> interface
! 858: [<cite><a href="#DOM3EV">DOM3Events</a></cite>]. The event has no namespace
! 859: (<code>Event.namespaceURI</code> is <code>null</code>).</dd>
1.1 avankest 860: </dl>
1.11 avankest 861:
1.1 avankest 862: <h2 class="no-num" id="bibref">References</h2>
1.11 avankest 863:
1.6 avankest 864: <dl>
1.11 avankest 865: <dt id="DOM3">[DOM3Core]</dt>
1.22 ! avankest 866:
1.11 avankest 867: <dd><cite><a href="http://www.w3.org/TR/DOM-Level-3-Core">Document Object
868: Model (DOM) Level 3 Core Specification</a></cite>, A. Le Hors, P. Le
869: Hégaret, L. Wood, G. Nicol, J. Robie, M. Champion, S. Byrne, editors.
870: World Wide Web Consortium, April 2004.</dd>
871:
872: <dt id="DOM3EV">[DOM3Events]</dt>
1.22 ! avankest 873:
1.1 avankest 874: <dd><cite><a href="http://www.w3.org/TR/DOM-Level-3-Events/">Document Object
1.11 avankest 875: Model (DOM) Level 3 Events Specification</a></cite>, Björn Höhrmann, editor.
876: World Wide Web Consortium, April 2006.</dd>
877:
1.14 avankest 878: <dt id="ref-ecmascript">[ECMAScript]</dt>
1.22 ! avankest 879:
1.14 avankest 880: <dd><cite><a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMAScript
881: Language Specification</a></cite>, Third Edition. ECMA, December 1999.</dd>
882:
883: <dt id="ref-rfc2046">[RFC2046]</dt>
1.22 ! avankest 884:
1.19 avankest 885: <dd><cite><a href="http://ietf.org/rfc/rfc2046">Multipurpose Internet Mail
886: Extensions (MIME) Part Two: Media Types</a></cite>, N. Freed, N. Borenstein,
887: editors. IETF, November 1996.</dd>
1.14 avankest 888:
1.11 avankest 889: <dt id="ref-rfc2109">[RFC2109]</dt>
1.22 ! avankest 890:
1.11 avankest 891: <dd><cite><a href="http://ietf.org/rfc/rfc2109">HTTP State Management
892: Mechanism</a></cite>, D. Kristol, L. Montulli, editors. IETF, February
893: 1997.</dd>
894:
895: <dt id="RFC2119">[RFC2119]</dt>
1.22 ! avankest 896:
1.11 avankest 897: <dd><cite><a href="http://ietf.org/rfc/rfc2119">RFC 2119: Key words
898: for use in RFCs to Indicate Requirement Levels</a></cite>, S. Bradner.
899: IETF, March 1997.</dd>
1.12 avankest 900:
1.11 avankest 901: <dt id="RFC2616">[RFC2616]</dt>
1.22 ! avankest 902:
1.11 avankest 903: <dd><cite><a href="http://ietf.org/rfc/rfc2616">Hypertext Transfer Protocol
904: -- HTTP/1.1</a></cite>, R. Fielding, J. Gettys, J. Mogul, H. Frystyk, L.
905: Masinter, P. Leach, T. Berners-Lee, editors. IETF, June 1999</dd>
1.12 avankest 906:
1.11 avankest 907: <dt id="ref-rfc2617">[RFC2617]</dt>
1.22 ! avankest 908:
1.11 avankest 909: <dd><cite><a href="http://ietf.org/rfc/rfc2617">HTTP Authentication: Basic
1.14 avankest 910: and Digest Access Authentication</a></cite>, ...</dd>
1.12 avankest 911:
1.11 avankest 912: <dt id="ref-rfc2965">[RFC2965]</dt>
1.22 ! avankest 913:
1.19 avankest 914: <dd><cite><a href="http://ietf.org/rfc/rfc2965">HTTP State Management
915: Mechanism</a></cite>, D. Kristol, L. Montulli, editors. IETF, October
916: 2000.</dd>
917:
1.11 avankest 918: <dt id="ref-rfc3986">[RFC3986]</dt>
1.22 ! avankest 919:
1.11 avankest 920: <dd><cite><a href="http://ietf.org/rfc/rfc3986">Uniform Resource Identifier
921: (URI): Generic Syntax</a></cite>, T. Berners-Lee, R. Fielding, L. Masinter,
922: editors. IETF, January 2005.</dd>
1.1 avankest 923: </dl>
1.11 avankest 924:
1.1 avankest 925: <h2 class="no-num" id="acknowledgements">Acknowledgements</h2>
1.11 avankest 926:
1.1 avankest 927: <p><em>This section is non-normative</em></p>
1.12 avankest 928:
1.7 avankest 929: <p>The editor would like to thank to the following people who have contributed
1.22 ! avankest 930: to this specification (ordered on first name):</p>
1.12 avankest 931:
1.1 avankest 932: <ul>
1.22 ! avankest 933: <li>Alex Hopmann</li>
1.7 avankest 934: <li>Alex Vincent</li>
1.15 avankest 935: <li>Alexey Proskuryakov</li>
1.1 avankest 936: <li>Asbjørn Ulsberg</li>
937: <li>Boris Zbarsky</li>
938: <li>Björn Höhrmann</li>
939: <li>Cameron McCormack</li>
940: <li>Christophe Jolif</li>
941: <li>Charles McCathieNevile</li>
942: <li>Dean Jackson</li>
943: <li>Doug Schepers</li>
944: <li>Douglas Livingstone</li>
945: <li>Gorm Haug Eriksen</li>
946: <li>Hallvord R. M. Steen</li>
947: <li>Håkon Wium Lie</li>
948: <li>Ian Davis</li>
949: <li>Ian Hickson</li>
950: <li>Ivan Herman</li>
951: <li>Jens Lindström</li>
952: <li>Jim Deegan</li>
953: <li>Jim Ley</li>
954: <li>Jonas Sicking</li>
955: <li>Julian Reschke</li>
956: <li>Karl Dubost</li>
957: <li>Maciej Stachowiak</li>
1.7 avankest 958: <li>Magnus Kristiansen</li>
1.1 avankest 959: <li>Marc Hadley</li>
960: <li>Mark Nottingham</li>
961: <li>Pawel Glowacki</li>
962: <li>Robin Berjon</li>
963: <li>Ruud Steltenpool</li>
964: </ul>
1.12 avankest 965:
1.1 avankest 966: <p>Special thanks to the Microsoft employees who first implemented the
1.22 ! avankest 967: <code>XMLHttpRequest</code> interface, which was first widely deployed by the
! 968: Windows Internet Explorer browser.</p>
1.12 avankest 969:
1.1 avankest 970: <p>Special thanks also to the WHATWG for drafing a first version of this
1.22 ! avankest 971: specification in their Web Applications 1.0 document.</p>
1.12 avankest 972:
1.1 avankest 973: <p>Thanks also to all those who have helped to improve this specification by
1.22 ! avankest 974: sending suggestions and corrections. (Please, keep bugging us with your
! 975: issues!)</p>
1.1 avankest 976: </body>
977: </html>
Webmaster