Page 1 of 1
refreshing back page
Posted: Fri Dec 09, 2005 1:08 am
by dude81
Hello
How do we do refresh the back page on clicking Back button of the browser tool bar.
I tried on
Code: Select all
onunload='window.location.reload()".
it didnt work
Posted: Fri Dec 09, 2005 11:19 am
by Chris Corbyn
Hmm... you wouldn't do it in the current page... you need the JS in the page you're going back to.
Perhaps passing a GET var and then using php to do something like
Code: Select all
if (isset($_GET['refresh']))
{
echo <<<SCRIPT
<script type="text/javascript">
<!-- Hide
window.location = '{$_SERVER['PHP_SELF']}'; //Drop the GET var and just reload
// -->
</script>
SCRIPT;
}
Perhaps there's a pure JS way to do it by looking at the history property.....
Posted: Fri Dec 09, 2005 11:57 am
by Burrito
I don't believe it can be done. You can put php headers at the top of the page to force a fresh copy with every new load but forcing a refresh by using the back button would require modification of the browser settings which (for *good* security reasons), can't be done.
One way I've gotten around it is to force the user back to the current page when they click back and provide a link to the previous page. This will force a page reload and accomplish what you're after. The biggest drawback is that some people get confused when they try to click back and it goes no where. I've therefore put a section of text at the top of my page that says "The back button on your browser will not work, Click here to go back" kinda thing....