Jump to content

How to get URL of parent frame?


misterm

Recommended Posts

Hi

 

In some situations, I use the following example to get the current url of the page I am working on.

 

<?

$thisPage = $_SERVER['REQUEST_URI'];

if ($thisPage == "/") {echo $thisPage; }

?>

 

If I have a php page in an iframe on a none php page, is there any way I can get the URI of the containing page from my script within the iframe?

 

Many Thanks

 

MisterM

 

 

Link to comment
https://forums.phpfreaks.com/topic/160469-how-to-get-url-of-parent-frame/
Share on other sites

I actually just ran into this same issue yesterday.

 

From what I'm reading no PHP variables will be able to return the parent frame URL but you should be able to use javascript such as window.parent.location.href

 

I ended up just sending the data I needed to the iframe as a GET variable and then used that in the iframe page as $url = $_GET;

 

Hope that helps.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.