Re: Header() to a different browser instance
| From: | dgw at q-logic dot org | Date: | Mon, 10 Jul 2000 17:27:45 +0000 |
| Subject: | Re: Header() to a different browser instance | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-5615@lists.php.net to get a copy of this message | ||
Hi,
Ive been testing a bit and theres no PHP involved, its all javascript, but
here goes anyway. The trick is in the self.opener which references the
window that opened the popup.
Lets say we have a file called one.html that opens a popup. It could look
like this:
<SCRIPT LANGUAGE="javascript">
function popup() {
window.open( "pop.html", "", "width=100,height=100" );
}
</SCRIPT>
<A HREF="javascript:popup()">Click here to continue</A>
The pop.html would be something like:
<SCRIPT LANGUAGE="javascript">
function closeme() {
self.opener.location.href="two.html";
self.close();
}
</SCRIPT>
<A HREF="javascript:closeme()">Close me</A>
This will close itself and redirect the opener to the page two.html.
Hope it helps
David Garcia Watkins
----- Original Message -----
>
> > Hello List,
> >
> > I've got some javascript that pops up a new browser window. From within
> > that browser I call a php script that does some sql, and then does a
> > Header redirect back to the original page (browser instance).
> >
> > However, with the Header() redirect my original page just gets created
> > inside the second instance popped-up browser.
> >
> > Alternatively, the following just closes the window, and the php script
> > is never called from the form.
> >
> > <input type="submit" name="Submit"
> > value="Add"onClick="closeWindow()">
> >
> > Can anyone share with me whether it is possible to do what I want to do
> > (essentially close a popped up browser and redirecting the original
> > browser instance), and give some advice on how to do it.
>