What is the HTTP Referer if the link is clicked in an <iframe>?

bodacydo picture bodacydo · Dec 12, 2011 · Viewed 22.1k times · Source

Suppose I have a webpage located at http://www.website.com with an <iframe> in it. Like this:

<html>
 <head>...</head>
 <body>
  ...
  <iframe src="http://www.washington.edu">
  ...
 </body>
</html>

Now suppose someone goes to www.website.com and clicks a link in the iframe itself (this link is located on www.washington.edu website).

My question is what is the HTTP Referer in this case?

Is it http://www.website.com (the page hosting iframe) or is it http://www.washington.edu (the page in which the link was clicked)?

Answer

muskratt picture muskratt · Dec 13, 2011

It depends on the browser.

Firefox and Safari will report the referrer as http://www.website.com while some versions of Internet Explorer will show http://www.washington.edu as the referrer.

UPDATE 2015-04: Testing latest versions of above mentioned, all of them would return http://www.washington.edu