Ajax Back, Forward, Reload and PHP 52
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."
Re:The old Slashdot... (Score:4, Informative)
@-moz-document domain(slashdot.org) {
body {
font: 82%/150% Times !important;
}
#contents { margin-left: 0em !important;}
div#links{display:none !important;}
}
Re:The old Slashdot... (Score:2)
Stupid (Score:3, Insightful)
This is terrible, and does nothing to make the back button in the browser work. At best, it gives you an undo/redo in the applications. The back button not working is more of a symptom than the actual problem, and if widely implemented this kind of workaround is only going to distract and make it less likely that the actual problem get fixed.
Re:Stupid (Score:1)
Cheers,
Siggy
Non-news (Score:5, Insightful)
Re:Non-news (Score:3, Informative)
Absolutely correct (Score:3, Informative)
Re:Absolutely correct (Score:2, Funny)
Re:Absolutely correct (Score:2)
That's the gut of 2advanced: incredible designs, but let's say they were never the sharpest programmers in class.
To put it simply (Score:4, Informative)
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.
Re:To put it simply (Score:5, Interesting)
Not a FF plug in, but it would be a seamless solution to the back button issue for a website.
-Rick
Re:To put it simply (Score:2)
-Rick
Er... already done (Score:5, Informative)
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.
Re:Er... already done (Score:2)
Re:Er... already done (Score:2)
Re:Er... already done (Score:2)
Re:Er... already done (Score:1)
I'm using Firefox 1.5.0.4 as well. I have the default security settings enabled. Sometimes when I hit the back button in GMail it works, but usually, I get the following message after a 30 second delay:
Loading...
This seems to be taking longer than usual. Your session may have been interrupted. If your account doesn't appear in the next few seconds, please refresh this page in your browser.
If you continue to have trouble loading your account, please visit the help center [google.com] for troubleshooting info
Re:Er... already done (Score:1)
browsers could support client-specified urls (Score:2, Insightful)
(Like when you change location.url -- it makes your browser actually go there, not just display different text in the address bar.)
Something like "Link to this page" could
Re:browsers could support client-specified urls (Score:4, Informative)
Re:Time to drag out this old chestnut: (Score:2)
Which one? (Score:1)
Re:Which one? (Score:3, Funny)
How about: (Score:3, Interesting)
Like something similar to this? [contentwithstyle.co.uk]
Tools that Support This (Score:5, Insightful)
Already been integrated into browser (Score:5, Insightful)
I'm 99.5% positive that Adobe Flex can help address using back/forward buttons in the browser and Google has code to do this with Ajax. If I'm not mistaken, Gmail no longer croaks if you try using back/forward now. I'm at work and don't want to take the time to look up the links, so (hopefully) free mod points to whoever feels like posting some links to this stuff!!
That being said, the article is garbage. People ARE integrating it into the browser controls... no point in using this crappy method. Fact is, most users will, through force of habit, use the back/forward buttons, or mouse gestures, or keyboard shortcuts.
Re:Already been integrated into browser (Score:4, Informative)
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.
Re:Already been integrated into browser (Score:4, Informative)
http://code.google.com/webtoolkit/ [google.com]
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...
Doesn't use the browser's back/forward (Score:3, Interesting)
Back Button Not a Problem (Score:5, Insightful)
A major challenge of Asynchronous JavaScript and XML (Ajax)-driven Web sites is the lack of a Back button
So says you. I say: if it makes sense for a user to hit your back button, why are you using Ajax? Do users hit their back button when they're using native desktop applications? Sounds to me like you're just to ajax-ify a traditional web application for the heluvit.
Re:Back Button Not a Problem (Score:2)
and it certainly makes sense to be able to go back to your previous viewing extent too.
Re:Back Button Not a Problem (Score:2)
Re:Back Button Not a Problem (Score:4, Insightful)
I don't track too many AJAXy sites, but I should think anything where you can have a significant
change in scope of the content presented (particularly when it makes up the bulk of the page and
there is little else in the way of controls or context) ought to allow the user to go back to a
previous scope. Mail box to mail box, browsing a nested discussion.
Re:Back Button Not a Problem (Score:2, Insightful)
Implemented using #anchor links and iframes (Score:2)
We implemented in-page history (and bookmarking) in Vox [vox.com] by overloading the anchor portion of the URI (the part after the #) and using iframes in IE. The anchor URI form is in simple key:value form that the JavaScript parses and triggers an event to enter the state specified.
Randy
Dojo (Score:1)
Re:Alright, enough with the dead language (Score:2)
PHP is a lost cause... please google for "Ruby on Rails". You'll find no bullshit coders there.
Ok, I'll bite...
PHP is not a lost cause precisely because of your last sentence - what people love about PHP is that you can do whatever you like, armed with nothing more than a few HTML tags, whether or not you have a clue what the implications are, whether or not you can spell "security hole", whether or not there is any prospect of your code being maintained, even by the original coder, a week after it has
Re:Alright, enough with the dead language (Score:1)
Re:Alright, enough with the dead language (Score:2)
Real coders use Scheme or XCPE for web apps
Real coders? So there is more than one person doing this?
And both amazingly powerful.
I don't doubt that Scheme at least is a wonderful language (although personally I prefer zetalisp). But how many libraries are there for, say, manipulating PDF, driving graphics packages or doing cryptography? Any coder who is reinventing every single wheel from scratch isn't a real coder. And how well does Scheme scale for web apps? How much native support does it have from
WebCT Vista vs Yahoo Mail (Score:3, Interesting)
When using a web browser you would expect that the standard functions to work, back and forward buttons, multiple tabs on a site and so on. But WebCT Vista doesn't let you do that! Oh no, it restricts you to one page and the navigation is terrible.
People already know how to use webpages, they do not need a new concept thrust at them, especially not a new concept that breaks the old.
I think that Yahoo mail works really well, it is an example of an online app that works with in the web browser concept and offers interaction beyond that for those who want to learn.
Hammering a nail with an Exacto knife (Score:2)
I'm not dissing Ajax - I'm just saying it's best used in certain circumstances. The times when you don't WANT the user to have arbitrary control over navigation - such as a shopping cart checkout or CMS tools, in which t
Those examples map to back/forward fairly well (Score:2)
Logic Structure for History (Score:1)
On Entering the page:
1) check the url for a hash that would say which subsection if it exists load that section (this resolves the problem of bookmarks, as the string after the hash will identify the specific section)
2) if there is no hash in the url, check