- From: Sjoerd Visscher <sjoerd@w3future.com>
- Date: Tue, 28 Feb 2006 23:47:50 +0100
- 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 http://w3future.com/weblog/
Received on Tuesday, 28 February 2006 22:48:03 UTC