Click to See Complete Forum and Search --> : Close Parent Window


Keeperofthecode
03-10-2005, 09:17 AM
I'm using the following code to open a new window. What can I add to automatically close the parent window when the new one opens?

<body
onfiltered="window.open('http://www.test.com/', 'mywindow', 'width=screen.width, height=screen.height, scrollbars=yes, resizable=yes')">
</body>

scragar
03-10-2005, 09:21 AM
<body
onfiltered="window.open('http://www.test.com/', 'mywindow', 'width=screen.width, height=screen.height, scrollbars=yes, resizable=yes'); window.self.close();">
</body>

Keeperofthecode
03-10-2005, 09:27 AM
Thanks for the help.

NogDog
03-10-2005, 09:46 AM
Argghh! Leave my browser alone. If I visited a site that closed my browser, I wouldn't visit it again unless it had "heroin content"*.

___________
* content I just have to have no matter what.

scragar
03-10-2005, 09:48 AM
is this forum one of those then?

NogDog
03-10-2005, 10:15 AM
Originally posted by scragar
is this forum one of those then?
It's pretty close to heroin content, maybe caffeine content? :)

Keeperofthecode
03-10-2005, 11:15 AM
OK, you're right. I shouldn't close their window. So how do I automatically redirect it to another page then?

NogDog
03-10-2005, 11:29 AM
// Javascript:
location = "some_page.html";
// or:
window.replace("http://www.site.com/some_page.html");

// PHP (must appear before any output to browser):
header("Location: http://www.site.com/some_page.html");

(Caveat: my JavaScript is a bit rusty.)