Slashdot Mirror


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."

7 of 52 comments (clear)

  1. Non-news by suv4x4 · · Score: 4, Insightful

    That has been discussed to death and known for years. You do it with a hidden iframe and anchor links (#blahblah). That's the gut of the whole deal.

  2. To put it simply by Kesch · · Score: 4, Informative

    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.
    1. Re:To put it simply by RingDev · · Score: 4, Interesting

      My thought would be to set the index page up to read that history stack cookie and redirect the browser to a live page. That way, if the user hit's the back button, they get kicked back to the index page. The index page slices the top item off the stack and redirects the user to the live page with the top item on the history stack as the target.

      Not a FF plug in, but it would be a seamless solution to the back button issue for a website.

      -Rick

      --
      "Most people in the U.S. wouldn't know they live in a tyrannical state if it walked up and grabbed their junk." - MyFirs
  3. Tools that Support This by MikeyTheK · · Score: 5, Insightful

    We already know that Morfik and GWT support all of these features, but does Script# or Atlas, yet? I didn't think so, but my memory may be faulty. Even more importantly than knowing how to support is not having to know how to support it. Thankfully AJAX is advancing so quickly that articles like this are going to be less and less relevant since more and more tools will just implement the features right out of the box.

    --
    Friends help you move. Real friends help you move bodies.
    Never forget: 2 + 2 = 5 for extremely large values of 2.
  4. Already been integrated into browser by dFaust · · Score: 4, 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.

  5. Back Button Not a Problem by mattwarden · · 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.

  6. Er... already done by brunes69 · · Score: 5, Informative

    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.