Ajax Back, Forward, Reload and PHP
IdaAshley writes "A major challenge of Asynchronous JavaScript and XML (Ajax)-driven Web sites is the lack of a Back button. Mike Brittain discusses ways to get around this obstacle in part 1 of the 'Developing PHP the Ajax way' series." From the article: "The Web is a page-by-page medium. The backward and forward buttons on your browser's toolbar direct the browser from page to page. When Macromedia's Flash became all of the rage, developers and users started to see how Rich Internet Applications (RIAs) break this metaphor. You might click around a few sites, land on a Flash-based Web site, then click around in it for a few minutes. One click of the Back button and the ride is over. Rather than going one step backward within the Flash site, you completely lose your place."
I felt the same way. I recommend you install the Stylish firefox extension and specify the following CSS modifications (also removes left hand nav bar):
@-moz-document domain(slashdot.org) {
body {
font: 82%/150% Times !important;
}
#contents { margin-left: 0em !important;}
div#links{display:none !important;}
}
All it does is create a history stack then store it as a cookie. The history is then used to power the back button in whatever the application is.
What'll intrigue me is when someone comes up with a way to integrate the back functions of ajax and friendsto work seamlessly with the browser back button. Hmm... someone should do a Firefox extension.
The hardest part would be deciding on a standard API for this.
If this signature is witty enough, maybe somebody will like me.
As other people have pointed out in other threads you can have working bookmarks without changing the window.location, using anchors. The site in my sig uses a primitive implementation but still needs a lot of work.
Struggling to find a day everyone can make? WhenShallWe.com
No. That would be the correct way to do this, but it looks as though the article tells you how to make your own set of alternative history buttons. Ugh.
http://outcampaign.org/
Ever use GMail? Next time you're ina folder hit your back button.
Guess what? Works as expected.
There's nothing magical about making the back and forward buttons work alonsgide AJAX. The way Google does it is to track a uniqke token that associates what your page state is on th ebackend, and pass the token along in an IFRAME every time you do something on the page. Since an IFRAME will work along withh your back/forward buttons, functionality is preserved.
It isn't rocket science. Sites who don't want to do this properly are either designed by people who don't know any better, are lazy, or some combination of the two.
You are right about Flex already doing this. Want proof? Go to http://maps.yahoo.com/beta :)/ 00000996.html
o uncement
Enter an address and hit enter, repeat n times, now use your browser back & forward buttons at will.
Flex has been doing this for a few years and many components support integration with the history manager out-of-the-box. More info here:
http://livedocs.macromedia.com/labs/1/flex20beta3
BTW: Flex 2 SDK is now free as in beer: http://labs.adobe.com/wiki/index.php/Flex:SDK_Ann
Disclaimer: I work for Adobe.
Not only does the hidden frame + named anchors work with AJAX, it also works for other browser-button-challenged technologies, like full flash sites. Case in point, one of the better known design studios (apparently does work for Ford, Motorola, AOL, Disney, Bacardi, etc) just relaunched, so click click click for working browser buttons.
Mooniacs for iOS and Android
Someone already responded with Flex info, but here's the Google link:
http://code.google.com/webtoolkit/
Under "Browser History Management" - "No, AJAX applications don't need to break the browser's back button."
And I'm sure Google's GWT ain't the only library in town to do this...