Skip to content
Permalink
Browse files

[] (0) location.resolveURL() for resolving relative URLs (for sending…

… to workers, in particular) (credit: js)

git-svn-id: http://svn.whatwg.org/webapps@2413 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
Hixie committed Nov 18, 2008
1 parent 13d335a commit eef04d047d2a37dd3be7f0e65689336de39f9b6d
Showing with 45 additions and 22 deletions.
  1. +22 −12 index
  2. +23 −10 source
34 index
@@ -17,7 +17,7 @@
<div class=head>
<p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG src=/images/logo></a></p>
<h1>HTML 5</h1>
<h2 class="no-num no-toc" id=draft-recommendation-&mdash;-date:-01-jan-1901>Draft Recommendation &mdash; 17 November 2008</h2>
<h2 class="no-num no-toc" id=draft-recommendation-&mdash;-date:-01-jan-1901>Draft Recommendation &mdash; 18 November 2008</h2>
<p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
<p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
<dl><dt>Multiple-page version:</dt>
void <a href=#dom-location-replace title=dom-location-replace>replace</a>(in DOMString url);
void <span title=dom-location-reload>reload</span>();

// <a href=#url-decomposition-attributes>URL decomposition attributes</a> <!-- blame brendan for these "innovative" names -->
// <a href=#url-decomposition-attributes>URL decomposition attributes</a> <!-- blame brendan for these "innovative" names -->
attribute DOMString <a href=#dom-location-protocol title=dom-location-protocol>protocol</a>;
attribute DOMString <a href=#dom-location-host title=dom-location-host>host</a>;
attribute DOMString <a href=#dom-location-hostname title=dom-location-hostname>hostname</a>;
attribute DOMString <a href=#dom-location-port title=dom-location-port>port</a>;
attribute DOMString <a href=#dom-location-pathname title=dom-location-pathname>pathname</a>;
attribute DOMString <a href=#dom-location-search title=dom-location-search>search</a>;
attribute DOMString <a href=#dom-location-hash title=dom-location-hash>hash</a>;

// resolving relative URLs
DOMString <a href=#dom-location-resolveurl title=dom-location-resolveURL>resolveURL</a>(in DOMString url);
};</pre>

<p>The <dfn id=dom-location-href title=dom-location-href><code>href</code></dfn>
with the <a href=#script-browsing-context>script browsing context</a> of the script that
invoked the method as the <a href=#source-browsing-context>source browsing context</a>.</p>

<p>The <code><a href=#location>Location</a></code> interface also has the complement of
<a href=#url-decomposition-attributes>URL decomposition attributes</a>, <dfn id=dom-location-protocol title=dom-location-protocol><code>protocol</code></dfn>, <dfn id=dom-location-host title=dom-location-host><code>host</code></dfn>, <dfn id=dom-location-port title=dom-location-port><code>port</code></dfn>, <dfn id=dom-location-hostname title=dom-location-hostname><code>hostname</code></dfn>, <dfn id=dom-location-pathname title=dom-location-pathname><code>pathname</code></dfn>, <dfn id=dom-location-search title=dom-location-search><code>search</code></dfn>, and <dfn id=dom-location-hash title=dom-location-hash><code>hash</code></dfn>. These must follow
the rules given for URL decomposition attributes, with the <a href=#concept-uda-input title=concept-uda-input>input</a> being <span title="the
document's address">the address</span><!-- XXXDOCURL --> of the page
represented by the associated <code>Document</code> object, as an
<a href=#absolute-url>absolute URL</a> (same as the <code title=dom-location-href><a href=#dom-location-href>href</a></code> attribute), and the <a href=#concept-uda-setter title=concept-uda-setter>common setter action</a> being the
same as setting the <code title=dom-location-href><a href=#dom-location-href>href</a></code>
attribute to the new output value.</p>

<!--
<!--XXX
<dfn title="dom-location-reload"><code>reload()</code></dfn>
reload during resize event:
redisplay the current page (without reloading it). This
user reload must be equivalent to .reload()
-->

<p>The <code><a href=#location>Location</a></code> interface also has the complement of
<a href=#url-decomposition-attributes>URL decomposition attributes</a>, <dfn id=dom-location-protocol title=dom-location-protocol><code>protocol</code></dfn>, <dfn id=dom-location-host title=dom-location-host><code>host</code></dfn>, <dfn id=dom-location-port title=dom-location-port><code>port</code></dfn>, <dfn id=dom-location-hostname title=dom-location-hostname><code>hostname</code></dfn>, <dfn id=dom-location-pathname title=dom-location-pathname><code>pathname</code></dfn>, <dfn id=dom-location-search title=dom-location-search><code>search</code></dfn>, and <dfn id=dom-location-hash title=dom-location-hash><code>hash</code></dfn>. These must follow
the rules given for URL decomposition attributes, with the <a href=#concept-uda-input title=concept-uda-input>input</a> being <span title="the
document's address">the address</span><!-- XXXDOCURL --> of the page
represented by the associated <code>Document</code> object, as an
<a href=#absolute-url>absolute URL</a> (same as the <code title=dom-location-href><a href=#dom-location-href>href</a></code> attribute), and the <a href=#concept-uda-setter title=concept-uda-setter>common setter action</a> being the
same as setting the <code title=dom-location-href><a href=#dom-location-href>href</a></code>
attribute to the new output value.</p>

<hr><p>The <dfn id=dom-location-resolveurl title=dom-location-resolveURL><code>resolveURL(<var title="">url</var>)</code></dfn> method must <a href=#resolve-a-url title="resolve a
url">resolve</a> its <var title="">url</var> argument, and if
that succeeds, return the resulting <a href=#absolute-url>absolute URL</a>. If it
fails, it must throw a <code>SYNTAX_ERR</code> exception
instead.</p>


<h5 id=security-3><span class=secno>5.8.4.1 </span>Security</h5>

<p>User agents must raise a <a href=#security-exception>security exception</a> whenever
33 source
void <span title="dom-location-replace">replace</span>(in DOMString url);
void <span title="dom-location-reload">reload</span>();

// <span>URL decomposition attributes</span> <!-- blame brendan for these "innovative" names -->
// <span>URL decomposition attributes</span> <!-- blame brendan for these "innovative" names -->
attribute DOMString <span title="dom-location-protocol">protocol</span>;
attribute DOMString <span title="dom-location-host">host</span>;
attribute DOMString <span title="dom-location-hostname">hostname</span>;
attribute DOMString <span title="dom-location-port">port</span>;
attribute DOMString <span title="dom-location-pathname">pathname</span>;
attribute DOMString <span title="dom-location-search">search</span>;
attribute DOMString <span title="dom-location-hash">hash</span>;

// resolving relative URLs
DOMString <span title="dom-location-resolveURL">resolveURL</span>(in DOMString url);
};</pre>

<p>The <dfn title="dom-location-href"><code>href</code></dfn>
with the <span>script browsing context</span> of the script that
invoked the method as the <span>source browsing context</span>.</p>

<!--XXX
<dfn title="dom-location-reload"><code>reload()</code></dfn>
reload during resize event:
redisplay the current page (without reloading it). This
theoretically would have no effect but in practice can be useful to
work around rendering bugs.

reload on shared Document updates all of them

user reload must be equivalent to .reload()
-->

<p>The <code>Location</code> interface also has the complement of
<span>URL decomposition attributes</span>, <dfn
title="dom-location-protocol"><code>protocol</code></dfn>, <dfn
same as setting the <code title="dom-location-href">href</code>
attribute to the new output value.</p>

<!--
<dfn title="dom-location-reload"><code>reload()</code></dfn>
reload during resize event:
redisplay the current page (without reloading it). This
theoretically would have no effect but in practice can be useful to
work around rendering bugs.
<hr>

reload on shared Document updates all of them
<p>The <dfn title="dom-location-resolveURL"><code>resolveURL(<var
title="">url</var>)</code></dfn> method must <span title="resolve a
url">resolve</span> its <var title="">url</var> argument, and if
that succeeds, return the resulting <span>absolute URL</span>. If it
fails, it must throw a <code>SYNTAX_ERR</code> exception
instead.</p>

user reload must be equivalent to .reload()
-->

<h5>Security</h5>

0 comments on commit eef04d0

Please sign in to comment.
You can’t perform that action at this time.