SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: history.back

  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2008
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    history.back

    Hi,

    I have used window.history.back() and it successfully redirects to page I wanted but that page is refreshed. I need to regain the original values posted in that page. How can I accomplish that ?

    Thanks
    Sampada

  2. #2
    SitePoint Guru SSJ's Avatar
    Join Date
    Jan 2007
    Posts
    830
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try Following:
    window.history.back(-1)

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2008
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yep, i had already tried that. But the page is still refreshed

  4. #4
    SitePoint Guru SSJ's Avatar
    Join Date
    Jan 2007
    Posts
    830
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's strange as I am using both of them:

    <a href="javascript: window.history.back(-1)">Back</a>
    <a href="javascript: window.history.back()">Back</a>
    And they are working fine for me.

    Can I see your URL Please?

  5. #5
    SitePoint Enthusiast
    Join Date
    Jun 2008
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    may be the information is not stored in cookie.

    I m using rapyd framework
    Back url is :http://localhost/xxxx/rapyd/sponsorform/commitment/1

    The code is like:
    $action = "javascript:window.history.back(-1)";
    $form->button("btn_back", "Go Back", $action, "BL");

  6. #6
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,813
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    You don't need -1 with back since back always goes back exactly one page. To go back two pages you'd use go(-2) instead.

    Whether a browser retains values for past pages or not depends on the browser. If you want all browsers to save the data then save it in a cookie while you are on that page the first time.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


Bookmarks

Posting Permissions

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