The Single Page Interface Manifesto
itsnat.sourceforge.net
itsnat.sourceforge.net
Pages are a good metaphor for many websites. Many RIAs are better suited to a single-screen metaphor (for example, my own business, Woobius, or GMail, or Google Maps), but to claim that, for example, a blog, or HN, should be single-page, is silly.
Use multi-page metaphors where it makes sense. Use single-page metaphors where it makes sense. Don't go on crusades trying to force round pegs into square holes, or vice versa.
This particular project chose to use GWT. While GWT provides a lot of good abstractions to build such application, I find the requirements for the project is disturbing: want to be like desktop, but looks like a web-app, but can do bookmarking, etc etc.
It suffers a lot of issues from:
1) Having to re-implement how the history works
2) Having data freshness issue vs not re-fetching every visit
3) Huge DOM structure within the single page
It's just too crazy. Luckily GWT ease the pain a little bit, but I wished we wouldn't go that far or at least cap the requirements with some limitations.
The JavaScript would parses the incoming JSON and attach listeners to all the elements. It had to do a few tricky things like tracking JS and CSS files and provide alternatives to dom:loaded so scripts could be rerun on dynamically loading content. Really Simple History was then used to track the state.
I built and tested the functionality as a plain HTML site first then builf the dynamic loader afterward, which was relatively easy to implement. Some of the trickiest parts were gettingand the DOM to update in a timely fashion and to get the interface to "feel" right (when do you clear the old page, when do you scroll user back to top of page, etc.).
Like emilis said, there are still a few small cases where the implemetation breaks down, mainly when sending or publishing links. I ended up enforcing clean links: if you hit a HTML page when you had JavaScript enabled it would take you to the homepage and reload your desired page from there. This was mainly because not doing so would make the copy-paste problems worst. E.g. If you expecting to see "bar" but had no JavaScript then example.com/foo#bar (showing foo rather than bar) would be more confusing seeing the homepage at example.com/#bar. The redirect logic was the first thing encountered on the page so was pretty quick. E.g. http://www.google.co.uk/search?q=http%3A%2F%2Fwww.thebeatles...
I wouldn't recommend implementing this unless you absolutely had to. For me the requirement for a streaming music player was a "must-have" feature. Even the quickest page load would still lead to skipping music.
Methinks you might have a somewhat non-standard definition of the term middleware. Please have your buzzword generator re-calibrated ;)
For example, SproutCore's routing system uses the first technique: http://docs.sproutcore.com/symbols/SC.routes.html
From the observer, the developer can then ensure the web app is in a state consistent with the hash part of the url, enabling the user to use the back and forward buttons within the app.
- user with JS enabled opens the website and navigates to some inner page
- user with JS copies the url for the inner page (e.g. http://example.org/#foo/bar)
- user with JS sends this url to a friend
- a friend with JS disabled opens the url and does not get the inner page.
Also -- what if a search engine "bookmarks" the page and a user with JS opens it? Do you:
a) redirect him from example.org/foo/bar to exmple.org/#foo/bar or...
b) do you leave the url untouched and wait until the user bookmarks another page as example.org/foo/bar#foo/baz ?
a) -- you waste processing power on visitors from search engines.
b) -- you waste processing power on the next opening of the bookmark. Also this looks like a bug waiting to happen.
Disclosure: I browse with JS turned off (Firefox NoScript extension) and websites that rely on JavaScript when a static page would do annoy me.
The server needs to be smart enough to read that hashtag and display the initial page in the correct state. It's just laziness to always load the same app and then immediately swap everything out based on hashes.
I send a link to a friend saying "check out the kittens": <example.com/product/pr0n#/product/kittens> My friend ends up on a completely different page and there is no explaination as to why the page is wrong. Secondly, the URL leaked information about my browsing history. Finally, Google page rank goes to /produces/pr0n rather than the cute kittens.
If the URL is <example.com/#/product/kittens> then my friend sees the homepage rather than the correct product page. At least they'll know they're on the right site and can easily search for the correct page manually. Google page rank goes to the homepage rather than some arbitrary page.
GMail can get away with using hashtags for navigation because it's an application you're never going to search or bookmark externally. Most plain-old web apps don't have that advantage, and therefore are bad candidates for hash-based navigation.
So yeah, this is tech that's been around for a while, and it's a convenient way to allow the browser back button to work in a single-page app. But I wouldn't recommend using it unless you have a good reason.
EDIT: As swombat says below, though, this isn't a natural fit for all types of websites, and it's a bit hyperbolic/silly to call this the next model of web development. That time might come, but it's not nearly here for the vast majority of sites.
The key is to use the URL hash to drive page changes in JS, so back button, browser history, and bookmarks all still work.
Especially in their image section: press "next" and use the back button immediately (but not too fast), you'll see some "oops"