saved by5 people, first byFranck on 2006-10-25, last byJoserra Mosteiro on 2008-06-08
-
How can you assign distinct URLs to different parts of your application?
- Expressive URLs are vital. The ability to link from one site to another is arguably what made the web successful. Furthermore, web surfers like to bookmark pages for later on. And these bookmarks are now a social phenomenon, with the advent of "linkblogs" and social bookmarking software like del.icio.us.
- Browsers retain URLs in their history, and the Back Button will only work if URLs vary. The Back Button is a big habit for many users. It can mean "Go back to where I was a minute ago". For many users, it can also mean "Undo my last action", and that mental model must be respected even though some experts deem it to be technically incorrect.
- A single address for your whole site is not enough - you need to support deep linking for links to be effective. That is, each distinct component of a website should have its own URL.
- In conventional websites, the URL changes when the page is refreshed, due to submitting a form or following a link. But in Ajax Apps, the page never refreshes, so the browser won't change the URL.
Unique URLs for significant application states
window.location.href = newURL;
under normal circumstances, the browser will automatically clear the page and load the new URL
The cunning workaround relies on fragment identifiers, those optional components of URLs that come after the hash character (#)
We want Ajax Apps to change the page URL without forcing a reload
window.location.hash = summary;
make the state change after a URL change