W3C home > Mailing lists > Public > public-webapi@w3.org > February 2006

Re: ISSUE-29: how is uri parameter of the open() method resolved

From: Sjoerd Visscher <sjoerd@w3future.com>
Date: Tue, 28 Feb 2006 23:47:50 +0100
Message-ID: <4404D316.5060207@w3future.com>
To: Jonas Sicking <jonas@sicking.cc>
CC: Anne van Kesteren <annevk@opera.com>, Web APIs WG <public-webapi@w3.org>

> file1.html:
> <iframe src="file2.html" id="frame"></iframe>
> <script>
> document.body.onload = function() {
>   document.getElementById('frame').contentWindow.doIt('./test.xml');
> }
> </script>
> file2.html:
> <script>
> function doIt(uri) {
>   xhr = new XMLHttpRequest();
>   xhr.open('GET', uri, false);
>   return xhr.responseXML;
> }
> </script>
> Should the uri "./test.xml" be resolved against "file1.html" or
> 'file2.html'. This is a real issue and something that people actually
> do. There is no way to always get this 'right' since the uri-string
> could have just as well come from file2.html.
> In mozilla we actually use file1.html as baseURI, though I would argue
> that we should use file2.html.

To get it perfectly right every string should have a base URI property. 
String literals get the base URI of the script element they are in. But 
then you would have to do this for every string generating item in the 
browser. F.e. the base URI of a string from input.value should probably 
be the base URI of the input element.

In any case I don't think it is correct to choose between windows, you 
should choose between base URIs of script elements.

Sjoerd Visscher
Received on Tuesday, 28 February 2006 22:48:03 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:16:19 UTC