Click to See Complete Forum and Search --> : Changing main window from popup...
jLoomis
02-08-2003, 07:05 PM
I need to open a pop-up window from the main window.
From one of the options, I need to close the window (that I got !) and load another page into the main window.
HELP!
AdamBrill
02-08-2003, 07:46 PM
try
window.referrer.location="http://whatever.com";
Make sure you do it before you close the window...
Charles
02-08-2003, 07:52 PM
Here you go. The trick is to keep things working when JavaScript isn't present.
test.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<title>Test 1</title>
<h1>Test 1</h1>
<p><a href="test2.html" onclick="window.open(this.href); return false">Click Me</a></p>
test2.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<title>Test 2</title>
<h1>Test 2</h1>
<p><a href="test.html" onclick="if (top.opener) {top.opener.location = this.href; top.close(); return false}">Click Me</a></p>