New Coder Posted February 21, 2007 Share Posted February 21, 2007 Hello all, Is there a way that I can get a page to refresh it's information if navigated to from another page using the refresh button. For instance: A user is viewing page 1, they navigate to page 2, they return to page 1 by preesing the back button. Can page 1 then refresh itself just incase the details have changed since last viewing? Many thanks Quote Link to comment Share on other sites More sharing options...
camdagr81 Posted February 21, 2007 Share Posted February 21, 2007 You could of course use $_SERVER['HTTP_REFERER'] and try to come up with a statement that would determine if the user was coming from a page that is ahead of the current page in the site map. <?php $ref = $_SERVER['HTTP_REFERER']; if (preg_match('/page2.php/i', $ref)) { header("Location: page1.php"); } ?> Quote Link to comment Share on other sites More sharing options...
hvle Posted February 21, 2007 Share Posted February 21, 2007 A user is viewing page 1, they navigate to page 2, they return to page 1 by preesing the back button. Can page 1 then refresh itself just incase the details have changed since last viewing? Interesting question! I think this is a browser problem, and since it is browser, you can not achieve this any how. As my understanding of course. Maybe someone else have diff idea. Anyway, you can set a refresh timer or something say 10 seconds and browser will refresh itself if updated information. Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 21, 2007 Share Posted February 21, 2007 Add no-cache headers to the pages. Quote Link to comment Share on other sites More sharing options...
New Coder Posted February 22, 2007 Author Share Posted February 22, 2007 Ok thanks, I will give the no-cache headers a try and will let you know how I get on. Many Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.