[whatwg] anchor(jump) DOM Event proposal
oyasumi at gmail.com
Wed Mar 8 05:49:03 PST 2006
> A common argument or complaint against AJAX is that it renders the back
> and forward buttons useless and thereby interrupting the normal flow of
> browsing. It is also impossible to bookmark the state of the page [due
> to the URL remaining the same]. Normally, navigating to a new URL will
> result in the browser performing a new request to the server, but there
> is one exception to that - which is invoking an anchor via # suffix.
+1 for making this a DOM event you could preventDefault(), and which
would trigger not only on programmatic state change of
(window.)location.hash, but similarly on user change.
It's worth noting that for the typical case of listening in on
programmatic change of location.hash, there is the generic feature
inherited from Object.prototype.watch, which lets you not only watch
but also decide over what happens to the value on modification. Try
this bookmarklet on a page that sets location.hash to see the former
value, which value it gets changed to and lets you pick another one
I would not consider your suggestion a solution to the ajax REST
problem, though still useful for reacting to a bookmark trying to
initiate a specific page state without reloading the page, which is
something that just doesn't work RESTfully today.
/ Johan Sundström, http://ecmanaut.blogspot.com/
More information about the whatwg