"Back"-Button and JavaScript

Discussion in 'Javascript' started by Victor, Sep 19, 2006.

  1. Victor

    Victor Guest

    Hi everybody,

    could anybody kindly give me a clue in dealing with a following problem

    I am developing a project, where the user navigates from page to page
    by means of links referring to JavaScript functions that do some
    processing of forms dispersed over those pages. Each page has its own
    element 'page' as an identifier. This processing occurs through a call
    for a function, which gets the id of the target page (looks like
    'move(id)'), finds out the id of the currently opened page and based on
    that calls a proper processing function; then it brings the user to the
    required page 'id'. All this stuff works brilliantly, but I encounter a
    problem when the user clicks the "Back" button of a browser.
    The page gets properly changed, no wonder. And the navigating link
    contains now a proper value as 'id' - but calls for a function that
    would be called on the page, where the "Back" had been clicked...

    I'll try to explain it more thouroughly with the following example:

    Page (7) contains a link with href='javascript:move(3)'. Should this
    link get clicked, the function move() would analyze the current page,
    find out an element 'page=7', call a function Func7() for processing
    the form on the page 7, thereafter I would jump to the page 3.
    Now I press the "Back" button of the browser and navigate to the page
    2, from where I had changed to the page 7. I get the page 2 displayed;
    this page contains link with href='javascript:move(4)'. So, I hope by
    clicking this link to call the function Func2() - because there is
    element 'page=2' on this page - for processing the form on the page 2,
    and then to jump to the page 4. It would work exactly this way, had I
    come to the page 2 by using the link with href='javascript:move(2)' on
    the page 7. But I did not, I navigated here a different way - through
    the button "Back".
    So now instead of calling the Func2(), the link 'move(4)' on the page 2
    calls for Func7(), as if I still were on the page 7...

    What is going wrong here?

    Many thanks in advance

    Victor, Sep 19, 2006
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sylvia sil
    Curt_C [MVP]
    Dec 29, 2004
  2. Chicagoboy27

    image button as a back button

    Chicagoboy27, Oct 26, 2006, in forum: ASP .Net
    Oct 30, 2006
  3. phancey
  4. Author
    Jan 22, 2009
  5. Useful Info

    Firefox back button takes me back 2 pages.

    Useful Info, Jun 3, 2007, in forum: Javascript
    Useful Info
    Jun 3, 2007

Share This Page