[whatwg] element.onFocus instead of window.onhashcange ?

On Sat, Nov 21, 2009 at 4:33 PM, Bjartur Thorlacius
<svartman95 at gmail.com> wrote:
> Could you please explain to me (forgive me, I haven't got much
> experience on this topic) why "webapps" can't either have a specific
> element for <inbox> and <sent mail>, or even different pages? Why is
> it so terrible to navigate to another page to fetch another mail
> folder? They have to fetch the data from the server anyway. And even
> if they wan't to do some fancy AJAXy stuff they can always use the
> HIDDEN attr (or CSS) to hide currently irrelevant parts of the app and
> fill in new data with JavaScript/ECMAScript as it arrives.

Storing state in the hash fulfills two goals:

1) The user should be able to bookmark a page or copy the URL to a new
tab or hit refresh and get back more or less the same page.

2) The page shouldn't become temporarily unresponsive, flicker, etc.
when the user navigates around.

Using the same URL for every page makes (1) impossible, clearly.
Changing any part of the URL other than the hash currently makes (2)
impossible as well, because if a script changes the path or whatnot,
that will make the browser throw away the current page and go get the
whole new page.  Therefore the only option is to change the hash.  Of
course, the pushState API in HTML5 is meant to obsolete this coding
strategy, by letting scripts change the URL of the page without
navigating.

Received on Sunday, 22 November 2009 14:21:49 UTC