Annotation of 2006/webapi/XMLHttpRequest/Overview.src.html, revision 1.24
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.24 ! avankest 30:
1.22 avankest 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.24 ! 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.24 ! avankest 38:
1.22 avankest 39: <dd><a href="http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060927/">http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060927/</a></dd>
1.24 ! avankest 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.24 ! 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.24 ! 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>
1.24 ! avankest 72:
1.22 avankest 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>
1.24 ! avankest 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.24 ! 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>
1.24 ! avankest 246:
1.1 avankest 247: <dt><dfn>conforming document</dfn></dt>
1.24 ! 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>
1.24 ! avankest 252:
1.1 avankest 253: <dt><dfn>conforming authoring tool</dfn></dt>
1.24 ! 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.24 ! avankest 366:
1.1 avankest 367: <dd>The initial value.</dd>
1.24 ! avankest 368:
1.1 avankest 369: <dt>1 Open</dt>
1.24 ! avankest 370:
1.1 avankest 371: <dd>The <code>open()</code> method has been successfully called.</dd>
1.24 ! avankest 372:
1.1 avankest 373: <dt>2 Sent</dt>
1.24 ! avankest 374:
1.15 avankest 375: <dd>The user agent successfully acknowledged the request.</dd>
1.24 ! avankest 376:
1.1 avankest 377: <dt>3 Receiving</dt>
1.24 ! 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>
1.24 ! avankest 381:
1.1 avankest 382: <dt>4 Loaded</dt>
1.24 ! 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.22 avankest 397: <p class="issue">Need to make it more clear what <code>null</code> means for
398: <var>user</var> and <var>password</var>.</p>
1.24 ! avankest 399:
! 400: <!-- XXX when password is null Internet Explorer doesn't send user ... -->
! 401:
! 402: <p>Invoking this method when the <code>readySteate</code> attribute is 0
! 403: (Uninitialized) <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.24 ! avankest 413: <p>Invocations of this method when <code>readyState</code> is not 0
! 414: (Uninitialized) or 4 (Loaded) <em class="ct">must</em> be ignored.</p>
! 415:
! 416: <!-- XXX I made this up. -->
! 417:
! 418: <p>Invoking this method when <code>readyState</code> is 4 (Loaded)
! 419: <em class="ct">must</em> be identical to when <code>readyState</code> is 0
! 420: (Uninitialized). Also, all members of the object <em class="ct">must</em> be
! 421: set to their initial values.</p>
! 422:
1.13 avankest 423: <p>If the <var>method</var> argument doesn't match the <dfn>method
1.22 avankest 424: production</dfn> defined in section 5.1.1 of
425: [<cite><a href="#RFC2616">RFC2616</a></cite>] a <code>SYNTAX_ERR</code>
426: <em class="ct">must</em> be raised by the user agent. If the user agent
427: doesn't support the given method for security reasons a
428: <code>SECURITY_ERR</code> <em class="ct">should</em> be raised.</p>
1.14 avankest 429:
1.13 avankest 430: <p>User agents <em class="ct">must</em> at least support the following list
1.22 avankest 431: of methods (see [<cite><a href="#RFC2616">RFC2616</a></cite>]):</p>
1.14 avankest 432:
1.13 avankest 433: <ul>
434: <li><code>GET</code></li>
435: <li><code>POST</code></li>
436: <li><code>HEAD</code></li>
437: <li><code>PUT</code></li>
438: <li><code>DELETE</code></li>
439: </ul>
1.16 avankest 440:
1.13 avankest 441: <p>User agents <em class="ct">should</em> support any <var>method</var>
1.22 avankest 442: argument that matches the <span>method production</span>.</p>
1.14 avankest 443:
1.13 avankest 444: <p>When <var>method</var> case-insensitively matches <code>GET</code>,
1.22 avankest 445: <code>POST</code>, <code>HEAD</code>, <code>PUT</code> or
446: <code>DELETE</code> the user agent <em class="ct">must</em> use the
447: uppercase equivalent instead.</p>
1.12 avankest 448:
1.21 avankest 449: <p>When <var>url</var> is a relative reference, it <em class="ct">must</em>
1.22 avankest 450: be resolved using <span><code>XMLHttpRequest</code> base resource
1.24 ! avankest 451: identifier reference</span> and the fragment identifier component, if any,
! 452: <em class="ct">must</em> be dropped. If it can't be resolved user agents
! 453: <em class="ct">must</em> throw a <code>SYNTAX_ERR</code>. When a non
! 454: same-origin <var>url</var> argument is given user agents
! 455: <em class="ct">should</em> throw a <code>SECURITY_ERR</code> exception.</p>
1.14 avankest 456:
1.19 avankest 457: <p class="note">A future version or extension of this specification will
1.22 avankest 458: define a way of doing cross-site requests.</p>
1.21 avankest 459:
1.24 ! avankest 460: <p class="issue">Do we need to say anything special about same-document references?</p>
1.21 avankest 461: <!--<p>If the <var>url</var> parameter doesn't match the syntax defined in
462: section 3.2.2 of [<cite><a href="#RFC2616">RFC2616</a></cite>] a
463: <code>SYNTAX_ERR</code> <em class="ct">must</em> be raised.</p>-->
464:
1.17 avankest 465: <p>User agents <em class="ct">should not</em> support the "user:password"
1.22 avankest 466: format in the <code>userinfo</code> production defined in section 3.2.1 of
467: [<cite><a href="#ref-rfc3986">RFC3986</a></cite>] and
468: <em class="ct">must</em> throw a <code>SYNTAX_ERR</code> when doing so (not
469: supporting it). When they do support it, or in case of people using the
470: format "user", user agents <em class="ct">must</em> use them if the
471: <var>user</var> and <var>password</var> arguments are omitted. If the
472: arguments are not omitted, they take precedence, even if they are
473: <code>null</code>.</p>
1.17 avankest 474:
475: <p>If the <var>user</var> argument doesn't match the
1.22 avankest 476: <code>username-value</code> production defined in section 3.2.2 of
477: [<cite><a href="#ref-rfc2617">RFC2617</a></cite>] user agents
478: <em class="ct">must</em> throw a <code>SYNTAX_ERR</code> exception.</p>
479:
480: <p class="issue">Need to look at the <var>password</var> argument. What
481: syntax does it need to match. Can it be UTF-8 on transmission? When it's
482: omitted, do UAs still use the user argument? IE doesn't.</p>
1.1 avankest 483: </dd>
1.12 avankest 484:
1.14 avankest 485: <dt><dfn id="dfn-setrequestheader" title="setrequestheader"><code>setRequestHeader(<var>header</var>,
1.22 avankest 486: <var>value</var>)</code></dfn>, method</dt>
1.12 avankest 487:
1.5 avankest 488: <dd>
489: <p>The nominated request header (<var>header</var>) field value
1.22 avankest 490: <em class="ct">must</em> be set to <var>value</var>, with the following
491: exceptions:</p>
1.14 avankest 492:
1.5 avankest 493: <ul>
494: <li>If the <code>readyState</code> attribute has a value other than 1
1.22 avankest 495: (Open) or the <span><code>send()</code> flag</span> is set an
496: <code>INVALID_STATE_ERR</code> exception <em class="ct">must</em> be
497: raised;</li>
1.14 avankest 498:
1.13 avankest 499: <li>If the <var>header</var> argument doesn't match the
1.22 avankest 500: <dfn><code>field-name</code> production</dfn> as defined by section 4.2
501: of [<cite><a href="#RFC2616">RFC2616</a></cite>] a <code>SYNTAX_ERR</code>
502: <em class="ct">must</em> be raised;</li>
1.14 avankest 503:
1.13 avankest 504: <li>If the <var>value</var> argument doesn't match the
1.22 avankest 505: <dfn><code>field-value</code> production</dfn> as defined by section 4.2
506: of [<cite><a href="#RFC2616">RFC2616</a></cite>] a <code>SYNTAX_ERR</code>
507: <em class="ct">must</em> be raised;</li>
1.14 avankest 508:
1.13 avankest 509: <li>For security reasons nothing <em class="ct">should</em> be done if the
1.22 avankest 510: <var>header</var> argument matches <code>Accept-Charset</code>,
511: <code>Accept-Encoding</code>, <code>Content-Length</code>,
512: <code>Expect</code>, <code>Date</code>, <code>Host</code>,
513: <code>Keep-Alive</code>, <code>Referer</code>, <code>TE</code>,
514: <code>Trailer</code>, <code>Transfer-Encoding</code> or
515: <code>Upgrade</code> case-insensitively.</li>
1.24 ! avankest 516:
1.22 avankest 517: <!-- XXX or should this throw an exception? -->
1.5 avankest 518: </ul>
519:
520: <p>Implementations <em class="ct">must</em> replace any existing value if
1.22 avankest 521: the nominated request header field value is one of:
522: <code>Authorization</code>, <code>Content-Base</code>,
523: <code>Content-Location</code>, <code>Content-MD5</code>,
524: <code>Content-Range</code>, <code>Content-Type</code>,
525: <code>Content-Version</code>, <code>Delta-Base</code>, <code>Depth</code>,
526: <code>Destination</code>, <code>ETag</code>, <code>Expect</code>,
527: <code>From</code>, <code>If-Modified-Since</code>, <code>If-Range</code>,
528: <code>If-Unmodified-Since</code>, <code>Max-Forwards</code>,
529: <code>MIME-Version</code>, <code>Overwrite</code>,
530: <code>Proxy-Authorization</code>, <code>SOAPAction</code> or
531: <code>Timeout</code>.</p>
1.14 avankest 532:
1.5 avankest 533: <p>Otherwise, if the nominated request header field already has a value, the
1.22 avankest 534: new value <em class="ct">must</em> be combined with the existing value
535: (section 4.2, [<cite><a href="#RFC2616">RFC2616</a></cite>]). See also the
536: <code>send()</code> method regarding user agent header handling for caching,
537: authentication, proxies, and cookies.</p>
1.14 avankest 538:
539: <div class="example">
540: <pre>// The following script:
541: var client = new XMLHttpRequest();
542: client.open('GET', 'demo.cgi');
543: client.setRequestHeader('X-Test', 'one');
544: client.setRequestHeader('X-Test', 'two');
545: client.send();
546:
547: // ...would result in the following header being sent:
548: ...
549: X-Test: one, two
550: ...</pre>
551: </div>
552:
1.13 avankest 553: <p>The list of request headers <em class="ct">must</em> be reset when the
1.22 avankest 554: <code>open()</code> method is invoked.</p>
1.5 avankest 555: </dd>
1.12 avankest 556:
1.14 avankest 557: <dt><dfn id="dfn-send" title="send"><code>send(<var>data</var>)</code></dfn>,
1.22 avankest 558: method</dt>
1.12 avankest 559:
1.17 avankest 560: <dd>
1.20 avankest 561: <p>If the <code>readyState</code> attribute has a value other than 1 (Open)
1.22 avankest 562: or the <span><code>send()</code> flag</code> is set an
563: <code>INVALID_STATE_ERR</code> exception <em class="ct">must</em> be
564: raised. Otherwise user agents <em class="ct">must</em> make a request to
565: <var>url</var> using method <var>method</var> and set the
566: <dfn><code>send()</code> flag</dfn>. If the <var>async</var> flag is set to
567: <code>false</code>, then the method <em class="ct">must not</em> return
568: until the request has completed. Otherwise, it <em class="ct">must</em>
569: return immediately. (See: <code>open()</code>.)</p>
1.21 avankest 570:
1.20 avankest 571: <p class="note">The <span><code>send()</code> flag</span> is only relevant
1.22 avankest 572: when <code>readyState</code> is 1 (Open).</p>
1.12 avankest 573:
574: <p>If <var>data</var> is passed to the <code>send()</code> method it
1.22 avankest 575: <em class="ct">must</em> be used for the entity body following these rules
576: (the term <dfn id="dfn-entity-body">entity body</dfn> is defined by section
577: 7.2.1 of [<cite><a href="#RFC2616">RFC2616</a></cite>]):</p>
1.12 avankest 578:
1.1 avankest 579: <ul>
580: <li>If <var>data</var> is a <code>DOMString</code>, it
1.22 avankest 581: <em class="ct">must</em> be encoded as UTF-8 for transmission.</li>
1.24 ! avankest 582:
1.1 avankest 583: <li>If the <var>data</var> is a <code>Document</code>, it
1.22 avankest 584: <em class="ct">must</em> be serialized using the encoding given by
585: <code><var>data</var>.xmlEncoding</code>, if specified and supported, or
586: UTF-8 otherwise [<cite><a href="#DOM3">DOM3Core</a></cite>].</li>
1.24 ! avankest 587:
1.1 avankest 588: <li>If <var>data</var> is not a <code>DOMString</code> or a
1.22 avankest 589: <code>Document</code> the host language its stringification mechanisms
590: <em class="ct">must</em> be used on the argument that was passed and the
591: result <em class="ct">must</em> be treated as if <var>data</var> is a
592: <code>DOMString</code>.</li>
1.1 avankest 593: </ul>
1.12 avankest 594:
1.16 avankest 595: <p>Invoking <code>send()</code> without the <var>data</var> argument
1.22 avankest 596: <em class="ct">must</em> give the same result as if it was invoked with
597: <code>null</code> as argument.</p>
1.12 avankest 598:
599: <p>Authors <em class="ct">should</em> specify the <code>Content-Type</code>
1.22 avankest 600: header via <code>setRequestHeader</code> before invoking
601: <code>send()</code> with an argument. If the argument to
602: <code>send()</code> is a <code>Document</code> and no
603: <code>Content-Type</code> header has been set user agents
604: <em class="ct">must</em> set it to <code>application/xml</code> for XML
605: documents and to the most appropriate media type for other documents (using
606: intrinsic knowledge about the document).</p>
1.12 avankest 607:
1.14 avankest 608: <p>If the response is an HTTP redirect (status code <code>301</code>,
1.22 avankest 609: <code>302</code>, <code>303</code> or <code>307</code>), then it
610: <em class="ct">must</em> be transparently followed (unless it violates
611: security, infinite loop precautions or the scheme isn't supported). Note
612: that HTTP ([<cite><a href="#RFC2616">RFC2616</a></cite>]) places
613: requirements on user agents regarding the preservation of the request
614: method during redirects, and also requires users to be notified of certain
615: kinds of automatic redirections.</p>
1.12 avankest 616:
1.15 avankest 617: <p>Once the request has been successfully acknowledged
1.22 avankest 618: <code>readyState</code> <em class="ct">must</em> be set to 2 (Sent).
619: Immediately before receiving the message body (if any), the
620: <code>readyState</code> attribute <em class="ct">must</em> be set to to 3
621: (Receiving). When the request has completed loading, the
622: <code>readyState</code> attribute <em class="ct">must</em> be set to 4
623: (Loaded). In case of a <code>HEAD</code> request <code>readyState</code>
624: <em class="ct">must</em> be set to 4 (Loaded) immediately after having gone
625: to 3 (Receiving).</p>
1.16 avankest 626:
1.15 avankest 627: <p>If something goes wrong (infinite loop, network errors) the
1.22 avankest 628: <code>readyState</code> attribute <em class="ct">must</em> be set to 4
629: (Loaded) and all other members of the object <em class="ct">must</em> be set
630: to their initial value. Besides that, all registered event listeners
631: <em class="ct">must</em> be removed.</p>
1.16 avankest 632:
1.15 avankest 633: <p class="note">In future versions of this specification user agents will be
1.22 avankest 634: required to dispatch an <code>error</code> event if the above occurs.</p>
1.14 avankest 635:
1.8 avankest 636: <p>If the user agent allows the specification of a proxy it
1.22 avankest 637: <em class="ct">should</em> modify the request appropriately;
638: <abbr title="in other words">i.e.</abbr>, connect to the proxy host instead
639: of the origin server, modify the <code>Request-Line</code> and send
640: <code>Proxy-Authorization</code> headers as specified.</p>
1.12 avankest 641:
1.14 avankest 642: <p>If the user agent supports <cite>HTTP Authentication</cite>
1.22 avankest 643: ([<cite><a href="#ref-rfc2617">RFC2617</a></cite>]) it
644: <em class="ct">should</em> consider requests originating from this object
645: to be part of the protection space that includes the accessed URIs and send
646: <code>Authorization</code> headers and handle <code>401 Unauthorised</code>
647: requests appropriately. if authentication fails, user agents
648: <em class="ct">should</em> prompt the users for credentials.</p>
1.12 avankest 649:
1.14 avankest 650: <p>If the user agent supports <cite>HTTP State Mangement</cite>
1.22 avankest 651: ([<cite><a href="#ref-rfc2109">RFC2109</a></cite>],
652: [<cite><a href="#ref-rfc2965">RFC2965</a></cite>]) it
653: <em class="ct">should</em> persist, discard and send cookies (as received in
654: the <code>Set-Cookie</code> and <code>Set-Cookie2</code> response headers,
655: and sent in the <code>Cookie</code> header) as applicable.</p>
1.12 avankest 656:
1.8 avankest 657: <p>If the user agent implements a HTTP cache
1.22 avankest 658: ([<cite><a href="#RFC2616">RFC2616</a></cite>]) it
659: <em class="ct">should</em> respect <code>Cache-Control</code> request
660: headers set by the author (<abbr title="for example">e.g.</abbr>,
661: <code>Cache-Control: no-cache</code> bypasses the cache). It
662: <em class="ct">must not</em> send <code>Cache-Control</code> or
663: <code>Pragma</code> request headers automatically unless the user explicitly
664: requests such behaviour (e.g., by (force-)reloading the page). <code>304 Not
665: Modified</code> responses that are a result of a user agent generated
666: conditional request <em class="ct">must</em> be presented as <code>200
667: OK</code> responses with the appropriate content. Such user agents
668: <em class="ct">must</em> allow authors to override automatic cache
669: validation by setting request headers (e.g., <code>If-None-Match</code>,
670: <code>If-Modified-Since</code>), in which case <code>304 Not Modified</code>
671: responses <em class="ct">must</em> be passed through.</p>
1.12 avankest 672:
1.8 avankest 673: <p>If the user agent implements server-driven content-negotiation
1.22 avankest 674: ([<cite><a href="#RFC2616">RFC2616</a></cite>]) it
675: <em class="ct">should</em> set <code>Accept-Language</code>,
676: <code>Accept-Encoding</code> and <code>Accept-Charset</code> headers as
677: appropriate; it <em class="ct">must not</em> automatically set the
678: <code>Accept</code> header. Responses to such requests
679: <em class="ct">must</em> have content-codings automatically removed.</p>
1.14 avankest 680:
681: <p>If the user agent supports Expect/Continue for request bodies
1.22 avankest 682: ([<cite><a href="#RFC2616">RFC2616</a></cite>]) it
683: <em class="ct">should</em> insert <code>Expect</code> headers and handle
684: <code>100 Continue</code> responses appropriately.</p>
1.8 avankest 685: </dd>
1.12 avankest 686:
1.14 avankest 687: <dt><dfn id="dfn-abort"><code>abort()</code></dfn>, method</dt>
1.12 avankest 688:
1.5 avankest 689: <dd>
690: <p>When invoked, this method <em class="ct">must</em> cancel any network
1.22 avankest 691: activity for which the object is responsible and set all the members of the
692: object to their initial values.</p>
1.24 ! avankest 693:
! 694: <p class="note">This means that the object <em>can</em> be used for another
! 695: request in which case this method will work again to cancel it.</p>
1.5 avankest 696: </dd>
1.12 avankest 697:
1.14 avankest 698: <dt><dfn id="dfn-getallresponseheaders"><code>getAllResponseHeaders()</code></dfn>,
1.22 avankest 699: method</dt>
1.12 avankest 700:
1.5 avankest 701: <dd>
702: <p>If the <code>readyState</code> attribute has a value other than 3
1.22 avankest 703: (Receiving) or 4 (Loaded), user agents <em class="ct">must</em> raise an
704: <code>INVALID_STATE_ERR</code> exception. Otherwise, it
705: <em class="ct">must</em> return all the HTTP headers, as a single string,
706: with each header line separated by a CR (U+000D) LF (U+000A) pair. The
707: status line <em class="ct">must not</em> be included.</p>
1.24 ! avankest 708:
1.5 avankest 709: <div class="example">
710: <pre>// The following script:
711: var client = new XMLHttpRequest();
1.14 avankest 712: client.open("GET", "test.txt", true);
1.5 avankest 713: client.send();
1.12 avankest 714: client.onreadystatechange = function() {
1.13 avankest 715: if(this.readyState == 3) {
1.12 avankest 716: print(this.getAllResponseHeaders());
717: }
718: }
1.5 avankest 719:
720: // ...should output something similar to the following text:
721: Date: 2004年10月24日 04:58:38 GMT
722: Server: Apache/1.3.31 (Unix)
723: Keep-Alive: timeout=15, max=99
724: Connection: Keep-Alive
725: Transfer-Encoding: chunked
726: Content-Type: text/plain; charset=utf-8</pre>
727: </div>
728: </dd>
1.12 avankest 729:
1.18 avankest 730: <dt><dfn id="dfn-getresponseheader" title="getresponseheader"><code>getResponseHeader(<var>header</var>)</code></dfn>,
1.22 avankest 731: method</dt>
1.12 avankest 732:
1.1 avankest 733: <dd>
1.13 avankest 734: <p>If the <var>header</var> argument doesn't match the
1.22 avankest 735: <span><code>field-name</code> production</span> a <code>SYNTAX_ERR</code>
736: <em class="ct">must</em> be raised. Otherwise this method works as described
737: below.</p>
1.14 avankest 738:
1.5 avankest 739: <p>If the <code>readyState</code> attribute has a value other than 3
1.22 avankest 740: (Receiving) or 4 (Loaded), the user agent <em class="ct">must</em> raise an
741: <code>INVALID_STATE_ERR</code> exception. Otherwise, it
742: <em class="ct">must</em> represent the value of the given HTTP header
743: (<var>header</var>) in the data received so far for the last request sent,
744: as a single string. If more than one header of the given name was received,
745: then the values <em class="ct">must</em> be concatenated, separated from
746: each other by an U+002C COMMA followed by an U+0020 SPACE. If no headers of
747: that name were received, then it <em class="ct">must</em> return
748: <code>null</code>. Header names <em class="ct">must</em> be compared
749: case-insensitively to the method its argument (<var>header</var>).</p>
1.12 avankest 750:
1.1 avankest 751: <div class="example">
752: <pre>// The following script:
753: var client = new XMLHttpRequest();
1.14 avankest 754: client.open("GET", "test.txt", true);
1.5 avankest 755: client.send();
1.12 avankest 756: client.onreadystatechange = function() {
1.13 avankest 757: if(this.readyState == 3) {
1.14 avankest 758: print(client.getResponseHeader("Content-Type"));
1.12 avankest 759: }
760: }
1.1 avankest 761:
1.5 avankest 762: // ...should output something similar to the following text:
763: Content-Type: text/plain; charset=utf-8</pre>
1.1 avankest 764: </div>
1.5 avankest 765: </dd>
1.12 avankest 766:
1.5 avankest 767: <dt><dfn id="dfn-responsetext"><code>responseText</code></dfn> of type
1.22 avankest 768: <code>DOMString</code>, readonly</dt>
1.12 avankest 769:
1.5 avankest 770: <dd>
771: <p>If the <code>readyState</code> attribute has a value other than 3
1.22 avankest 772: (Receiving) or 4 (Loaded), the user agent <em class="ct">must</em> raise an
773: <code>INVALID_STATE_ERR</code> exception. Otherwise, it
774: <em class="ct">must</em> be the fragment of the <span>entity body</span>
775: received so far (when <code>readyState</code> is 3 (Receiving)) or the
776: complete <span>entity body</span> (when <code>readyState</code> is 4
777: (Loaded)), interpreted as a stream of characters.</p>
1.12 avankest 778:
779: <p>If the response includes a <code>Content-Type</code> understood by the
1.22 avankest 780: user agent the characters are encoded following the relevant media type
781: specification, with the exception that the rule in the final paragraph of
782: section 3.7.1 of [<cite><a href="#RFC2616">RFC2616</a></cite>], and the
783: rules in section 4.1.2 of [<cite><a href="#ref-rfc2046">RFC2046</a></cite>]
784: <em class="ct">must</em> be treated as if they specified the default
785: character encoding as being UTF-8. Invalid bytes <em class="ct">must</em> be
786: converted to U+FFFD REPLACEMENT CHARACTER. If the user agent can't derive a
787: character stream in accord with the media type specification,
788: <code>reponseText</code> <em class="ct">must</em> be <code>null</code>.</p>
1.12 avankest 789:
790: <p>Its initial value <em class="ct">must</em> be the <code>null</code>.</p>
1.21 avankest 791:
1.24 ! avankest 792: <p class="note">For <code>HEAD</code> requests this attribute will always
! 793: be <code>null</code> (it remains unchanged). Similar to the
1.22 avankest 794: <code>responseXML</code> attribute.</p>
1.5 avankest 795: </dd>
1.12 avankest 796:
1.5 avankest 797: <dt><dfn id="dfn-responsexml"><code>responseXML</code></dfn> of type
1.22 avankest 798: <code>Document</code>, readonly</dt>
1.12 avankest 799:
1.8 avankest 800: <dd>
801: <p>If the <code>readyState</code> attribute has a value other than 4
1.22 avankest 802: (Loaded), user agents <em class="ct">must</em> raise an
803: <code>INVALID_STATE_ERR</code> exception. Otherwise, if the
804: <code>Content-Type</code> header contains a media type (ignoring any
805: parameters) that is either <code>text/xml</code>,
806: <code>application/xml</code>, or ends in <code>+xml</code>, it
807: <em class="ct">must</em> be an object that implements the
808: <code>Document</code> interface representing the parsed document. If
809: <code>Content-Type</code> did not contain such a media type, or if the
810: document could not be parsed (due to an XML well-formedness error or
811: unsupported character encoding, for instance), it <em class="ct">must</em>
812: be <code>null</code>.</p>
1.12 avankest 813:
1.8 avankest 814: <p>Its initial value <em class="ct">must</em> be <code>null</code>.</p>
1.5 avankest 815: </dd>
1.12 avankest 816:
1.22 avankest 817: <dt><dfn id="dfn-status"><code>status</code></dfn> of type <code>unsigned
818: short</code>, readonly</dt>
1.12 avankest 819:
1.5 avankest 820: <dd>
821: <p>If the <code>status</code> attribute is not available an
1.22 avankest 822: <code>INVALID_STATE_ERR</code> exception <em class="ct">must</em> be raised.
823: It <em class="ct">must</em> be available when <code>readyState</code> is 3
824: (Receiving) or 4 (Loaded). When available, it <em class="ct">must</em>
825: represent the HTTP status code (typically <code>200</code> for a successful
826: connection).</p>
1.12 avankest 827:
1.8 avankest 828: <p>Its initial value <em class="ct">must</em> be <code>0</code>.</p>
1.12 avankest 829: </dd>
830:
1.5 avankest 831: <dt><dfn id="dfn-statustext"><code>statusText</code></dfn> of type
1.22 avankest 832: <code>DOMString</code>, readonly</dt>
1.12 avankest 833:
1.5 avankest 834: <dd>
835: <p>If the <code>statusText</code> attribute is not available an
1.22 avankest 836: <code>INVALID_STATE_ERR</code> exception <em class="ct">must</em> be raised.
837: It <em class="ct">must</em> be available when <code>readyState</code> is 3
838: (Receiving) or 4 (Loaded). When available, it <em class="ct">must</em>
839: represent the HTTP status text sent by the server (appears after the status
840: code).</p>
1.21 avankest 841:
1.8 avankest 842: <p>Its initial value <em class="ct">must</em> be the empty string.</p>
1.1 avankest 843: </dd>
844: </dl>
1.12 avankest 845:
1.1 avankest 846: <p>HTTP requests sent from multiple different <code>XMLHttpRequest</code>
1.22 avankest 847: objects in succession <em class="ct">should</em> be pipelined into shared HTTP
848: connections.</p>
1.12 avankest 849:
1.10 avankest 850: <h3 id="events">Events for the <code>XMLHttpRequest</code> Object</h3>
1.12 avankest 851:
1.1 avankest 852: <p>These sections describe the various events that can be dispatched on the
1.22 avankest 853: object implementing the <code>XMLHttpRequest</code> interface. For this
854: version of the specification only one event is defined.</p>
1.12 avankest 855:
1.1 avankest 856: <dl>
857: <dt><dfn id="dfn-readystatechange"><code>readystatechange</code></dfn></dt>
1.24 ! avankest 858:
1.1 avankest 859: <dd>The <code>readystatechange</code> event <em class="ct">must</em> be
1.22 avankest 860: dispatched when <code>readyState</code> changes value. It <em class="ct">must
861: not</em> bubble, <em class="ct">must not</em> be cancelable and
862: <em class="ct">must</em> implement the <code>Event</code> interface
863: [<cite><a href="#DOM3EV">DOM3Events</a></cite>]. The event has no namespace
864: (<code>Event.namespaceURI</code> is <code>null</code>).</dd>
1.1 avankest 865: </dl>
1.11 avankest 866:
1.1 avankest 867: <h2 class="no-num" id="bibref">References</h2>
1.11 avankest 868:
1.6 avankest 869: <dl>
1.11 avankest 870: <dt id="DOM3">[DOM3Core]</dt>
1.24 ! avankest 871:
1.11 avankest 872: <dd><cite><a href="http://www.w3.org/TR/DOM-Level-3-Core">Document Object
873: Model (DOM) Level 3 Core Specification</a></cite>, A. Le Hors, P. Le
874: Hégaret, L. Wood, G. Nicol, J. Robie, M. Champion, S. Byrne, editors.
875: World Wide Web Consortium, April 2004.</dd>
876:
877: <dt id="DOM3EV">[DOM3Events]</dt>
1.24 ! avankest 878:
1.1 avankest 879: <dd><cite><a href="http://www.w3.org/TR/DOM-Level-3-Events/">Document Object
1.11 avankest 880: Model (DOM) Level 3 Events Specification</a></cite>, Björn Höhrmann, editor.
881: World Wide Web Consortium, April 2006.</dd>
882:
1.14 avankest 883: <dt id="ref-ecmascript">[ECMAScript]</dt>
1.24 ! avankest 884:
1.14 avankest 885: <dd><cite><a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMAScript
886: Language Specification</a></cite>, Third Edition. ECMA, December 1999.</dd>
887:
888: <dt id="ref-rfc2046">[RFC2046]</dt>
1.24 ! avankest 889:
1.19 avankest 890: <dd><cite><a href="http://ietf.org/rfc/rfc2046">Multipurpose Internet Mail
891: Extensions (MIME) Part Two: Media Types</a></cite>, N. Freed, N. Borenstein,
892: editors. IETF, November 1996.</dd>
1.14 avankest 893:
1.11 avankest 894: <dt id="ref-rfc2109">[RFC2109]</dt>
1.24 ! avankest 895:
1.11 avankest 896: <dd><cite><a href="http://ietf.org/rfc/rfc2109">HTTP State Management
897: Mechanism</a></cite>, D. Kristol, L. Montulli, editors. IETF, February
898: 1997.</dd>
899:
900: <dt id="RFC2119">[RFC2119]</dt>
1.24 ! avankest 901:
1.11 avankest 902: <dd><cite><a href="http://ietf.org/rfc/rfc2119">RFC 2119: Key words
903: for use in RFCs to Indicate Requirement Levels</a></cite>, S. Bradner.
904: IETF, March 1997.</dd>
1.12 avankest 905:
1.11 avankest 906: <dt id="RFC2616">[RFC2616]</dt>
1.24 ! avankest 907:
1.11 avankest 908: <dd><cite><a href="http://ietf.org/rfc/rfc2616">Hypertext Transfer Protocol
909: -- HTTP/1.1</a></cite>, R. Fielding, J. Gettys, J. Mogul, H. Frystyk, L.
910: Masinter, P. Leach, T. Berners-Lee, editors. IETF, June 1999</dd>
1.12 avankest 911:
1.11 avankest 912: <dt id="ref-rfc2617">[RFC2617]</dt>
1.24 ! avankest 913:
1.11 avankest 914: <dd><cite><a href="http://ietf.org/rfc/rfc2617">HTTP Authentication: Basic
1.14 avankest 915: and Digest Access Authentication</a></cite>, ...</dd>
1.12 avankest 916:
1.11 avankest 917: <dt id="ref-rfc2965">[RFC2965]</dt>
1.24 ! avankest 918:
1.19 avankest 919: <dd><cite><a href="http://ietf.org/rfc/rfc2965">HTTP State Management
920: Mechanism</a></cite>, D. Kristol, L. Montulli, editors. IETF, October
921: 2000.</dd>
922:
1.11 avankest 923: <dt id="ref-rfc3986">[RFC3986]</dt>
1.24 ! avankest 924:
1.11 avankest 925: <dd><cite><a href="http://ietf.org/rfc/rfc3986">Uniform Resource Identifier
926: (URI): Generic Syntax</a></cite>, T. Berners-Lee, R. Fielding, L. Masinter,
927: editors. IETF, January 2005.</dd>
1.1 avankest 928: </dl>
1.11 avankest 929:
1.1 avankest 930: <h2 class="no-num" id="acknowledgements">Acknowledgements</h2>
1.11 avankest 931:
1.1 avankest 932: <p><em>This section is non-normative</em></p>
1.12 avankest 933:
1.7 avankest 934: <p>The editor would like to thank to the following people who have contributed
1.22 avankest 935: to this specification (ordered on first name):</p>
1.12 avankest 936:
1.1 avankest 937: <ul>
1.22 avankest 938: <li>Alex Hopmann</li>
1.7 avankest 939: <li>Alex Vincent</li>
1.15 avankest 940: <li>Alexey Proskuryakov</li>
1.1 avankest 941: <li>Asbjørn Ulsberg</li>
942: <li>Boris Zbarsky</li>
943: <li>Björn Höhrmann</li>
944: <li>Cameron McCormack</li>
945: <li>Christophe Jolif</li>
946: <li>Charles McCathieNevile</li>
947: <li>Dean Jackson</li>
948: <li>Doug Schepers</li>
949: <li>Douglas Livingstone</li>
950: <li>Gorm Haug Eriksen</li>
951: <li>Hallvord R. M. Steen</li>
952: <li>Håkon Wium Lie</li>
953: <li>Ian Davis</li>
954: <li>Ian Hickson</li>
955: <li>Ivan Herman</li>
956: <li>Jens Lindström</li>
957: <li>Jim Deegan</li>
958: <li>Jim Ley</li>
959: <li>Jonas Sicking</li>
960: <li>Julian Reschke</li>
961: <li>Karl Dubost</li>
962: <li>Maciej Stachowiak</li>
1.7 avankest 963: <li>Magnus Kristiansen</li>
1.1 avankest 964: <li>Marc Hadley</li>
965: <li>Mark Nottingham</li>
966: <li>Pawel Glowacki</li>
1.24 ! avankest 967: <li>Q42</li>
1.1 avankest 968: <li>Robin Berjon</li>
969: <li>Ruud Steltenpool</li>
970: </ul>
1.12 avankest 971:
1.1 avankest 972: <p>Special thanks to the Microsoft employees who first implemented the
1.22 avankest 973: <code>XMLHttpRequest</code> interface, which was first widely deployed by the
974: Windows Internet Explorer browser.</p>
1.12 avankest 975:
1.1 avankest 976: <p>Special thanks also to the WHATWG for drafing a first version of this
1.22 avankest 977: specification in their Web Applications 1.0 document.</p>
1.12 avankest 978:
1.1 avankest 979: <p>Thanks also to all those who have helped to improve this specification by
1.22 avankest 980: sending suggestions and corrections. (Please, keep bugging us with your
981: issues!)</p>
1.1 avankest 982: </body>
983: </html>
Webmaster