Jump to content


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

  • Please log in to reply
1 reply to this topic

#1 logged_with_bugmenot

  • Members
  • PipPipPip
  • Advanced Member
  • 62 posts

Posted 08 July 2006 - 02:59 AM

I need a code that will grab the parent URL of a popup.
Does anyone know of one?
Earn money with Google AdSense

#2 Travis Estill

Travis Estill
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 08 July 2006 - 04:35 AM

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");

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

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

Freelance Web Developer with a focus on PHP/MySQL


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users