W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2011

[whatwg] Document's base URI should use the document's *current* address

From: Justin Lebar <justin.lebar@gmail.com>
Date: Wed, 27 Apr 2011 15:52:52 -0400
Message-ID: <BANLkTikQ0P7WTZ3O6dRMs9LC4Ffkr-mzow@mail.gmail.com>
The document base URL [1] is used when fetching resources.

Right now, if a page doesn't have a <base> element, the document base
URL is set to the document's address. ?(I'm going to call this the
"document's original address".) ?The document's original address does
not change when you call pushState; only the document's current
address [2] does.

I think the base URI should use the document's current address, not
the original address.

To see why this makes sense, consider the following scenario:

* User loads page.html
* Page calls pushState and changes its url to page2.html
* User clicks on a link with href "#foo".

As currently specified, we'll resolve #foo relative to the document's
original URL; that is, clicking the link will take the user to
page.html#foo, not page2.html#foo. ?But the intent of a link with href
#foo is clearly to navigate within the current page, not to go
somewhere else.

Firefox 4 already implements pushState as I'm suggesting here.

-Justin

[1] http://www.whatwg.org/specs/web-apps/current-work/multipage/urls.html#document-base-url
[2] http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#the-document%27s-current-address
Received on Wednesday, 27 April 2011 12:52:52 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:03 GMT