misterm Posted June 1, 2009 Share Posted June 1, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/160469-how-to-get-url-of-parent-frame/ Share on other sites More sharing options...
Daniel0 Posted June 1, 2009 Share Posted June 1, 2009 No. Well, it might be in HTTP_REFERER, but I'm not sure. I suppose you can check that out. You shouldn't rely on that though. Quote Link to comment https://forums.phpfreaks.com/topic/160469-how-to-get-url-of-parent-frame/#findComment-846808 Share on other sites More sharing options...
misterm Posted June 1, 2009 Author Share Posted June 1, 2009 Hi Thanks for the reply. I tried your suggestion but it didn't come up with anything I could use. Thanks again Mr M No. Well, it might be in HTTP_REFERER, but I'm not sure. I suppose you can check that out. You shouldn't rely on that though. Quote Link to comment https://forums.phpfreaks.com/topic/160469-how-to-get-url-of-parent-frame/#findComment-847228 Share on other sites More sharing options...
ldougherty Posted June 1, 2009 Share Posted June 1, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/160469-how-to-get-url-of-parent-frame/#findComment-847251 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.