- From: Justin Lebar <justin.lebar@gmail.com>
- Date: Wed, 22 Feb 2012 13:11:17 +0100
> From an author's point of view, there's no such thing as the
> document's original URI and, unless you're a nerd, you've never heard
> of the base URI. ?There's just the document's URI, modified by
> pushState.
>
> From this point of view, I'd say it's less surprising that relative
> URIs would break when you change directories (hey, you *asked* for it)
> than that anchor refs would update the browser's address bar and
> document.location relative to the old URI.
In my tests, Chrome and Firefox both immediately change
document.baseURL when you call pushState. Images (and I presume other
resources) are resolved relative to the new base.
I'm not sure why your earlier test with seemed to "work" in Chrome, Hixie. :-/
I think this ship may have sailed.
-Justin
<button onclick='push()'>Click me</button>
function push() {
history.pushState('', '', '/' + Math.random() + '/file');
alert(document.baseURI);
}
Received on Wednesday, 22 February 2012 04:11:17 UTC