close a window

J

Jenny

I open page 1 and page 2 from main page. I want to close page 2 from
page 1 after I finish processing some work in page 1. Does anyone
know how to do that?

Thanks,

Jenny
 
D

DU

Jenny said:
I open page 1 and page 2 from main page. I want to close page 2 from
page 1 after I finish processing some work in page 1. Does anyone
know how to do that?

Thanks,

Jenny

Jenny, you need to give more details, explanations. Usually, in web
programming newsgroups such as this one, the *best* is to provide an url
so that regulars of this newsgroup and javascript experts can see the
page: these people can examine, understand your pages' logic as fast as
you can read the newspapers' headlines.

Here, I don't know if the opener opens page1 and then page1 opens page2
and how these pages are opened: automatically? via target attribute or
via window.open()? And if you opened these or 1 of the 2 with
window.open(), then how you coded all this.. etc.etc..

An url is best to figure this out or sufficient chunks of relevant code.

DU
 
M

ManoDestra

I'm assuming that page 1 is opening the page 2 and page 3. If this is the
case, then you could probably just get page 3 to call a function in page 1
to do the close other wise you will probably get a security error message as
you can't close a page from javascript on a page that didn't open the page
in the first place. Need user authorisation to proceed with it.

on page 3...

window.opener.myClose();

function myClose() {
page1.close();
}

Not easy to describe this, but I hope you get the idea.

Peter.
 
P

point

Nice...but maybe you could help me....

I have also a window opener and a function like this...

function alert_message()
{
if(!popup && !popup.open && popup.closed) alert("Don't forget to
refresh!");
}

and I call that function from child window with:

body onunload="document.opener.alert_message()">

but I don't get alert message when I close a child window...

any suggestions ???

respect...
 
R

Richard Cornford

and I call that function from child window with:

body onunload="document.opener.alert_message()">

but I don't get alert message when I close a child window...
<snip>

opener is not a property of the document object, it is a property of the
global (window) object. So:-

onunload="opener.alert_message();"
-or-
onunload="window.opener.alert_message();"

- should work better.

Ricahrd.
 
M

Mosley Jones III

point said:
Nice...but maybe you could help me....

I have also a window opener and a function like this...

function alert_message()
{
if(!popup && !popup.open && popup.closed) alert("Don't forget to
refresh!");
}

and I call that function from child window with:

body onunload="document.opener.alert_message()">

window.operner not document
 
P

point

Hy guys...

thanx for the help...

I tried this:
onunload="opener.alert_message();"

and got the error: popup in undefined???

I opened a window using this:

function popUp(URL)
{
openwindow=window.open(URL, 'popup',
'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=3
00,height=400,top=0,left=0');
}

respect...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,077
Messages
2,570,566
Members
47,202
Latest member
misc.

Latest Threads

Top