Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 800
Norbert Tamas Avatar asked May 08 '10 02:05

Norbert Tamas


People also ask

Can an iframe get parent URL?

When a page is running inside of an iframe, the parent object is different than the window object. You can still access parent from within an iframe even though you can't access anything useful on it. This code will never cause an error even when crossing origins.

Can iframe access parent windows?

The window will get opened by using the iframe, and the communication could be done with the parent window from the child window. To call a parent window function, use the following syntax and also refer to the code given below.

How can I change parent URL in iframe?

1) click on images link in iframe changes Parent page, click on another iframe image link changes Parent to another page (see below). can you please post the code you're currently using, in addition to the link you provided? You need to name the parent and use the target attribute.


1 Answers

This should be:

parent.document.referrer

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

like image 170
Anthony Avatar answered Oct 14 '22 00:10

Anthony