www.webdeveloper.com
Results 1 to 4 of 4

Thread: session cookie forgotten by backbutton in 3 of 5 browsers

  1. #1
    Join Date
    Mar 2012
    Posts
    4

    session cookie forgotten by backbutton in 3 of 5 browsers

    This simple cookie page,
    http://superfly.co.nz/myCookie.htm
    attempts to keep a simple numerical value stored for one browser session, if a user goes forward to a page(contact in the example), and then back to the page above by back button.
    Chrome and IE8 are putting the number into a form input, as planned.
    Opera 9.6, Safari 3.2.3 for Windoes, and Firefox 9.0.1 forget the cookie's value, unless the page is refreshed.
    Is there a better way to help all browsers remember the value I'm hoping to send back to a Perl script, for users who keep using the back button?
    Thanks.

  2. #2
    Join Date
    Feb 2011
    Posts
    231
    Hi
    I'm not sure if it works, but try add these meta in the Head of the html document, to prevent browsers cache the page.
    Code:
    <meta http-equiv="Cache-control" content="no-cache">
    <meta http-equiv="Cache-control" content="no-store">
    <meta http-equiv="Expires" content="-1">

  3. #3
    Join Date
    Mar 2012
    Posts
    4
    Thanks for the meta tags.
    I pasted them in to the head of the page, but Firefox, Opera, and Safari still seem to forget the cookie value after going forward to abc.htm, unless the myCookie.htm page is refreshed.

  4. #4
    Join Date
    Mar 2012
    Posts
    4
    Problem seems to have been solved for Firefox, Opera, and Safari for Windows.
    A variable z inside the script tags was assigned a value of 0, and
    an unload event was added to the body tag:
    <body onunload="javascript:z=1">

    From the backbutton, Firefox, Opera, and Safari seen to go back to the exact state of the page as the page was after finishing loading.
    Using an unload event seems to persuade those 3 browsers, and hopefully others, to go back to the earlier page state.
    Chrome and Internet Explorer seem to go back to earlier page states without an unload event.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles