Jump to content

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:

[code]<?php
$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:

[code]<?php
$parent = urldecode($_GET['parent']);
?>[/code]

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.