Is it possible to get the referrer of an iFrame's parent page with JavaScript in iFrame?

Norbert Tamas picture Norbert Tamas · May 8, 2010 · Viewed 15.1k times · Source

Is it possible to get the referrer of an iFrame's parent page with JavaScript in iFrame?

Example: Page A has an iFrame. The iFrames referrer is be page A. But is is possible to get Page A's referrer in the iFrame with JavaScript?

Answer

Anthony picture Anthony · May 8, 2010

This should be:

parent.document.referrer

Anything in the window that creates the iframe should be accessible through the parent scope.