Denoteone Denoteone - 1 year ago 92
HTML Question

Get Referrer Page without HTTP_REFERER

Is it possible to get the referrer page if

is not turned on and you dont have access to the php.ini file?

I used
and saw nothing about HTTP_REFERER in the echoed data.

Below is my script to get the referrer site info but now I need to use JavaScript but am not sure how to work it in:

$last_page = GetHostByName($_SERVER['HTTP_REFERER']);

if(strpos($last_page,"fall2011")) {
echo '<li><a href="'. $last_page .'" class="navigation-link">Fall 2011</a></li>';
} else {
echo $last_page;

Answer Source

That's not possible.

Best what you could do is to throw in some JavaScript.

var referrer = document.referrer;

If you need this in the PHP side (and thus the requirement can't be accomplished by JS alone), then you need to let JS send it by Ajax, or add it as a hidden input field of a form, or append as a query string to internal page links. The hard part is associating the right referrer with the requested page in the server side.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download