Jump to content

Back button gives an expired warning


SCook

Recommended Posts

When I click the back button on a page generated by php, to go back to a listing page generated by php, I get this:

 

Warning: Page has Expired The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you.

 

To resubmit your information and view this Web page, click the Refresh button.

 

Does anyone know a way to prevent this?  Thanks

Link to comment
Share on other sites

Don't click the back button...

 

It's a browser thing, there's nothing you can do server side to prevent it that I know of off hand. 

 

The only thing that might work, and I've never tried it, so I don't know, is to set the expire header to some date in the future, rather than the past...however if the user visits the page in the future, but before the expire, and you want them to have updated data, the browser may not display it...it may pull from the cache.

Link to comment
Share on other sites

Yes, well not clicking the button isn't the solution, as I have no control over what the users of this site do, and I garuntee they'll click the back button.  There's got to be a way to just...go back.  I think it must be partly because of the sessions, because in other circumstances, this does not happen

Link to comment
Share on other sites

There isn't any way to prevent people from using the browser controls (including the 'back' button). The best you can do is give them a clickable link back that's nice and obvious:

 

<a href="javascript:history.go(-1)">Return to previous page</a>

 

The alternative is to show the page in a new window. Then it'll have no history so the browser 'back' button will be useless.  Then you'll need to close that window to get back to where you/they were:

 

<a href="javascript:window.close()">Close this window</a>

 

 

Link to comment
Share on other sites

Well, I did find a sort of "stop gap" solution to this problem.  Instead of submitting my search form directly to listing.php, I use an intermediary file that then resends all posted form info to the listing.php like this:

<?

$qs = "?";
foreach ($_POST as $key => $val) {
$qs .= $key . "=" . $val . "&";
}

header("Location: listing.php$qs");

?>

 

It's not the best solution, because I'd rather not have this huge query string in the nav, but it isn't as if this is a big security issue, and one could always encode the data if desired.  But it bypasses ht ebrowser's pychotic need to resubmit a form.  What say ye? :-)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.