Results 1 to 2 of 2

Thread: Browser back button with dynamic ajax content

  1. #1
    Join Date
    May 2010
    Thanked 0 Times in 0 Posts

    Question Browser back button with dynamic ajax content

    1) Script Title: Dynamic Ajax Content

    2) Script URL (on DD):

    3) Describe problem: Not exactly a problem. Using this script to avoid page refresh issues, but is there some way to load the browsers "back button" to allow a standard approach to using the webpage. i.e. use browser back button to get previous content loaded by the script?

    Best regards, Dave Melnyk

  2. #2
    Join Date
    Mar 2006
    Illinois, USA
    Thanked 690 Times in 678 Posts


    The back button will work for anything that changes the URL. The only way to change the URL without reloading the page is to change what is called the "fragment", which is the part after the #. These are usually used for anchors. But you can use them here too.

    <a href="#content1" onclick="ajaxevent();">

    However, there is a problem: now you can use the back button to move back to an earlier URL (with an earlier fragment, like #content1 or #content2), but the content will not change because the Ajax script is not sensitive to changes in the URL.

    I'm not sure what the best way to fix this is. One way to approach it would be to use an "onload" event to check what is in the URL fragment and load that.

    Let's see if someone else has an idea about it.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts