kensbeijing Posted July 2, 2008 Share Posted July 2, 2008 I need a command that will make the browser return to the page before using php? Will this work inside an iframe? Link to comment Share on other sites More sharing options...
zppblood Posted July 2, 2008 Share Posted July 2, 2008 <?php $page=$_SERVER['HTTP_REFERER']; // This would be set to the previous page if the user clicked on a link or submit button in a form. header('Location: '.$page);?> Link to comment Share on other sites More sharing options...
Jack McKalling Posted July 2, 2008 Share Posted July 2, 2008 The HTTP_REFERRER takes the browser history, and iframes are taken into account in the history, so yes, that will work Link to comment Share on other sites More sharing options...
justsomeguy Posted July 2, 2008 Share Posted July 2, 2008 It's not the history, the referer (which is misspelled) is a header that the browser sends to the server when it requests a page. It will not send the referer header if you are going from an SSL-enabled page to a non-SSL page, and there are also options in several browsers not to send referer headers at all. If you type an address into the URL, regardless of your history or if you are on a page currently, the browser will not send a referer header. The referer header is used to tell the server where the link to the page was that the user clicked on, it's most often used with analytics packages to keep track of which search engines users are coming from. If you click a link on a Google result page the referer header will also include all of the search terms that the user searched for, so the site can also determine what keywords led a user to their site. It doesn't have anything to do with history though, the history is an internal part of the browser, the browser doesn't send its history to anything. When a browser requests a page inside of a frame it uses the parent page as the referer, if I remember correctly. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.