Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Am I the last page in the history?

    I know that Javascript cannot look at the URLs in the browser's history object. I am not concerned with the content.

    I have a page that is a serious problem when user's hit the BACK button and get to it because it causes a ping-pong affect of going back, and then loading the next page again (and again and again) each time the user hits back.

    Is there any way to know if the page being displayed is not the last page in the history?

    If I can see that it is not the last page then I can send the user to the correct page instead of just pushing them forward.

    THANKS!

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,799
    Thanks
    78
    Thanked 4,410 Times in 4,375 Posts
    Why not just set a cookie (with no expiration, so it will just be an in-memory session cookie) on the page with the BACK problem. So then when you do get to the page the BACK goes to, if the cookie is present you know to send them someplace different (after erasing the cookie, on the assumption they might cycle back through again, possibly).
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    schworak (01-11-2012)

  • #3
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    There are several paths that a user can use to get to that screen with the ping-pong issue so I would need to clear the cookie the first time it loads off the server. Let me play with that idea. It is a good suggestion if I can make it work.

  • #4
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,695
    Thanks
    6
    Thanked 1,011 Times in 984 Posts
    Cookies are a problem for people that are blocking cookies, though. The actual root of the problem is the page that redirects people without their consent and this is where you should start solving the problem. Isn’t there any other way to achieve what you want?

  • #5
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    AWESOME!

    Why didn't I think of that in the first place. So slick and simple. The server generates a unique value when the page loads and tucks it in as a javascript variable. Then when the user hits BACK the code doesn't regenerate at the server level so the script can kick to the correct page.

    No more Ping-Pong!

  • #6
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by VIPStephan View Post
    Cookies are a problem for people that are blocking cookies, though. The actual root of the problem is the page that redirects people without their consent and this is where you should start solving the problem. Isn’t there any other way to achieve what you want?
    No, not in this case.

    And all the users must have cookies enabled or they can't get this far into the application.


  •  

    Posting Permissions

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