Page 2 of 2

Posted: Tue May 25, 2004 2:08 pm
by loongest
i try it but it doesnt work.....
if my header file seperate with the page that created the popup
where should i place the statement to ?

Posted: Tue May 25, 2004 2:10 pm
by loongest
this is the structure of my code
----------------------------------
header.php
pagecreatedpopup.php
footer.php

Posted: Tue May 25, 2004 2:56 pm
by feyd
an exact example of what I was talking about.
tested in IE6 & Mozilla 0.8

Code: Select all

<?php

$now = date("Y.m.d H:i:s T",time());

$self = $_SERVER['SCRIPT_NAME'];

if(isset($_GET['popup']))
{
	echo <<<DONE
<html>
	<head>
		<title>$now</title>
	</head>
	<script language="Javascript">
	function reloadOpener()
	{
		window.opener.location.href = window.opener.location.href;
	}
	</script>
	<body onunload="reloadOpener()">
		$now<br />
		$self<br />
		<a href="javascript:reloadOpener()">refresh opener</a><br />
		<a href="javascript:window.close()">close window</a><br />
		<script language="Javascript">document.write(window.opener.location);</script>
	</body>
</html>
DONE;
}
else
{
	echo <<<DONE
<html>
	<head>
		<title>$now</title>
	</head>
	<script language="Javascript">
	function openWindow()
	{
		window.open('$self?popup','test','width=300,height=300,left=300,top=300,screenX=300,screenY=300');
	}
	</script>
	<body>
		$now<br />
		$self<br />
		<a href="javascript:openWindow()">open popup</a><br />
	</body>
</html>
DONE;
}

?>

Posted: Tue May 25, 2004 2:58 pm
by dull1554
do you use javascript window.open to open the popup?

if not the window.opener statement wont work

also that onunload statement needs to go in the body tag of the popup window not either of the other pages(header/footer....)

and the net effect should be the same even though the output is generated by multiple pages, it's still one html document that the browser sees, and the same 1 that launches the popup, so it should not present a problem how you have it set up

Posted: Tue May 25, 2004 6:29 pm
by loongest
feyd, thanks for the code u post ! but it still not what i can understand.. sorry for my stupid :(

the coding u post that perform:
first time- the pop up window is open (example time is2004.05.26 07:16:41 Malay Peninsula Standard Time) and the mainpage time is 2004.05.26 07:22:05 Malay Peninsula Standard Time

after the popup window is close the mainpage time remain same
2004.05.26 07:22:05

second time - the popup window open again time is 2004.05.26 07:16:41 Malay Peninsula Standard Time the mainpage time remain same.

how could i achieve something like....when i open the popup and that is a freshpage on popup. After i close that popup it influence the mainpage to refresh.

When nextime open the popup again...it will refresh the popup window and close the popup again.. mainpage get refresh....