Jump to content


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


Is there a code that grabs the URL of a parent window of a popup?

Recommended Posts

You could append the parent URL to the query string in JavaScript:

$parent = "http://".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'];

window.open("http://www.example.com/?parent=<?php echo urlencode($parent); ?>","mywindow");[/code]

Then, on the popup page, grab that GET variable like this:

$parent = urldecode($_GET['parent']);

Share this post

Link to post
Share on other sites


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.