Reputation: 4007
What would the HTTP referrer be in the following cases:
I cant seem to find an answer, If I cant get an answer here then i'll just make the pages and test it.
Upvotes: 4
Views: 2856
Reputation: 23559
I am too lazy to try to interpret all given scenarios, but to help test things one can easily created a PHP script to return an image that tells us what the referrer is:
<?php
header("Content-type: image/png");
header("Cache-control: no-cache");
header("Pragma: no-cache");
header("Expires: -1");
$s = "Referrer: " . $_SERVER['HTTP_REFERER'];
$im = @imagecreate(500, 13)
or die("Cannot Initialize new GD image stream");
$black = imagecolorallocate($im, 0, 0, 0);
imagecolortransparent($im, $black);
$red = imagecolorallocate($im, 255, 0, 0);
imagestring($im, 3, 0, 0, $s, $red);
imagepng($im);
imagedestroy($im);
?>
If a web site responds with a HTTP redirect, like 302 Moved Temporarily
, then your browser will still send the original referrer with the redirected request:
<?php
header("Location: http://[..]/referrer-to-img/referrer.php?redirected");
?>
Please note that, for example in Safari on a Mac, Command-click (to open a link in a new tab) and Command-Option-click (new window) do set the referrer for that link, while choosing "Open Link in New Tab/Window" from the context menu (after a right-click) does not.
Happy testing. ;-)
Upvotes: 5
Reputation: 655489
The Referer is always the document/resource that is referring to the current resource. So:
Upvotes: 2
Reputation: 75235
First off, HTTP Referer may be just about anything which various privacy-aware software client-side or even on some gateway/proxy on the way may turn it to be.
Yet let me take a crack at it:
1. That of the second web site 2. That of the second web site 3. pretty sure (not certain) but the second site still seems to be the right response.
Whatever the current page is at the time the browser sends a request (be it for an image, a redirection, whatever) is [normally] sent to the server underlying the URL of the request. [again, if no privacy device of sorts change this and other HTTP header values]
Upvotes: 1
Reputation: 62894
Guesses, but I'm pretty confident:
Upvotes: 0
Reputation: 351566
The referrer would be the third website.
The referrer is always the host of the HTTP request.
The referrer would be the different website.
Even though the page uses a meta refresh it is still an HTTP request and the previous rule applies.
The referrer would be the second website.
iframe
requests are treated just like requests in new browser windows.
Upvotes: 1