[BACK] Return to Overview.src.html CVS log [TXT] [DIR] Up to [Public] / 2006 / webapi / XMLHttpRequest

Annotation of 2006/webapi/XMLHttpRequest/Overview.src.html, revision 1.233

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

Webmaster

AltStyle によって変換されたページ (->オリジナル) /