SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2005
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Javascript back button solution?

    I have a page where users can filter a list of links using javascript clicks. The user then clicks a link in that list, views the page and then clicks back on the browser to view the rest of the list but the javascript options they filtered in the list are gone resulting in them having to do it all over again. Is there a solution to this?

    Would it work if I store their selections in a cookie each time they click a javascript button and then when they visit a link and click back (to what is presumably now a cached page) will I be able to have javascript that will read the cookie and reset their options again or is the cookie not loaded on a cached page?

    Are there any common solutions to this kind of thing?

  2. #2
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Open the links in a new window...


  3. #3
    SitePoint Enthusiast
    Join Date
    Sep 2005
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The links go to different pages on my own site so new windows would not really be apropriate. I think I have it working with cookies, at least the cookie info is still there when I click back. I'm in the process of getting the script realise a back click has just happened.

  4. #4
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    from what I understand back doesn't fire the onload event so how would you be able to check those cookie values?


  5. #5
    SitePoint Enthusiast
    Join Date
    Sep 2005
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm outputting the cookie data to the screen using javascript/innerHTML to change the cotents of a div. I could have it wrong, still working on it. First time I've messed with cookies and my javascript experience is not vast either.


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
  •