Refresh page after clicking browse back button

ChrisTERiS
ChrisTERiS used Ask the Experts™
on
In page "A" there is a link to page "B". How I can force refresh of page "A" when user clicks the back button being in page "B"?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Kiran Paul VJComputer Engineer

Commented:
Why do need to refresh page A? Is it due to cache problems.

Add no cache headers in page A so that browsers will not cache it.

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">

Clear browser cache manually before checking.

Author

Commented:
Thank you, but is not a cache problem. In page A there is an Ajax grid. Leaving the page I'm storing the grid's status in cookied and when user comes back, I'm restoring them. The code below works fine with IE but not with FF, Chrome etc. The only that I noticed is that if I refresh the page it loads the cookies. That's why I asked how I can refresh the page.
<script type="text/javascript"> 
	if ($.browser.msie == true) {         
		function warning() 
		{ 
			DG_Do(); 
		} 
		window.onload = warning; 		
	} else {   
jQuery(window).ready(function() {
DG_Do(); 
});	
	} 
</script>  	

Open in new window

Finally this is the solution that I found useful to refresh the page once as I wanted:

if (self.name != '_refreshed_')
{
self.name = '_refreshed_';
self.location.reload(true);
}
else self.name = '';	
</script> 

Open in new window


_refreshed_ is a dummy word. You can use anything there.

Author

Commented:
The other solution didn't worked. So I spent my time searching till to find a working solution.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial