I’ve been looking around on the web and I can’t find a solution to my issue.
Lets say on the following page I have an iframe.
http://www.mysite.com/cakes.php - this is the url of the page the iframe is on
This is the iframe code on that page
<iframe src = "http://www.mysite.com/secret_frame.php"></iframe>
In the iframe (the file secret.php), how would I get the URL of the page the iframe is situated on, so in this case it would be http://www.mysite.com/cakes.php.
Thanks
Frank
The iframed page,
secret_frame.php, can access the parent-page including it through the$_SERVER['HTTP_REFERER']variable.As mentioned in @Sven’s answer, you can’t completely trust the Referrer sent to the page though. Directly from the manual: