Re: Non-hierarchical base URLs (was Re: draft-abarth-url-01 uploaded)

On May 3, 2011, at 3:18 PM, Roy T. Fielding wrote:

> On May 3, 2011, at 1:31 PM, Maciej Stachowiak wrote:
>> On May 3, 2011, at 12:24 PM, Roy T. Fielding wrote:
>>> Color me confused.  I have never seen actual (non-test) content
>>> on the Web that has an arbitrary base URI (one that is unusable
>>> in practice).  What is the use case?  Is this a javascript idiom
>>> that I am not familiar with?
>> 
>> In the test case quoted above, "about:blank" is a real URI that actually gets loaded. It neither arbitrary nor unusable.
> 
> Yes, I know what happens in the test case.  What I don't understand
> is why you think that case is worth testing.  What is the use case?
> Why would a web page include an iframe that loads "about:blank"
> (which itself is not interoperable) and then perform a sequence of
> javascript actions that include a relative reference?

It is a very common pattern on the web for pages to load an about:blank iframe which is then populated using completely using script - document.write, innerHTML, or other DOM calls. We've had to fix bugs to ensure that relative URLs in such a context resolve against the parent frame's URL as the base.

Which part are you skeptical about, the fact that about:blank frames are often populated using script from the outside, or that the contents thereby injected would involve resolution of relative URLs? 

Note that the important case here is not dumping the href property of an anchor tag from script, that is just for ease of demonstration purposes. What's important is what happens when you traverse the link, or navigate in other ways such as by assigning the location property.

> I don't have a problem with HTML5 prohibiting the use of certain
> URI schemes as a base URI, assuming the HTML parsers revert to
> whatever valid base URI was previously active by context, but
> I would like to make standards decisions based on real examples.

If you doubt that about:blank iframes populated with script frequently appear on the Web, then that seems like an undue level of skepticism for someone familiar with real-world web content. In any case, this particular issue is not directly relevant to URL parsing (it's already handled by HTML5), so we don't really need to come to a conclusion here. It's only cases where HTML5 does not (and will not) specify an alternate base URL that we need to worry about.

Regards,
Maciej

Received on Tuesday, 3 May 2011 22:31:33 UTC