need to close main window on child opens succesfully

J

Jaggu

Hi ,

I need to close main window, once the child window succesfully opens
else main window to remain. In my case when I close the main window
immediately after the "window.open()" as mentioned below, both the main
and child disappears(this is due to pop up blocker) disappears
suddenly. I want to make the browser know if pop up blocks the child
window(in case).

help me how to check the child window opened successfuly or not, on
successful closing the main window.


//main window
function onLoad(){
var feat =
'toolbar=no,directories=no,location=no,status=no,menubar=no,resizable=no,scrollbars=no,width=1000,height=400';
win =
window.open('/nxtt/jsp/main.jsp','_blank','scrollbars=yes,resizable=yes,menubar=no,toolbar=no,status=no');


thanks for time

regards
Jaggu
 
R

Randy Webb

Jaggu said the following on 5/11/2006 1:42 PM:
Hi ,

I need to close main window, once the child window succesfully opens
else main window to remain.

Then click the X on the corner of the browser.
In my case when I close the main window immediately after the
"window.open()" as mentioned below, both the main and child
disappears(this is due to pop up blocker) disappears suddenly.
I want to make the browser know if pop up blocks the child
window(in case).

Stop trying to close my windows, you don't have that problem.
help me how to check the child window opened successfuly or not, on
successful closing the main window.

Search the archives, it has been explained before.
//main window
function onLoad(){
var feat =
'toolbar=no,directories=no,location=no,status=no,menubar=no,resizable=no,scrollbars=no,width=1000,height=400';

Hmmm, no toolbar, no location bar, you can't kill my statusbar, no
resize. Are you crazy?
 
G

Gérard Talbot

Jaggu wrote :
Hi ,

I need to close main window, once the child window succesfully opens
else main window to remain.

IE 7 beta 2 has fixed that issue/possibility: you will never be able to
close a window which has not been opened via javascript. You never
should have been able to do this in the first place.
As a general rule, a script can never close a window which was not
opened via javascript.

In my case when I close the main window
immediately after the "window.open()" as mentioned below, both the main
and child disappears(this is due to pop up blocker) disappears
suddenly. I want to make the browser know if pop up blocks the child
window(in case).

help me how to check the child window opened successfuly or not, on
successful closing the main window.


//main window
function onLoad(){
var feat =
'toolbar=no,directories=no,location=no,status=no,menubar=no,resizable=no,scrollbars=no,width=1000,height=400';

Let's get into your perspective versus the users' perspective. The user
has a window which has a toolbar, a location bar, a status bar and a
menubar: all these are fully and completely under the user's control.
And you want a secondary window to open and to have no toolbar, no
location bar, no status bar, no menubar.

Do you think that your plan and design is user-friendly?

Gérard
 
P

pegasusflightresources

Gérard Talbot said:
Jaggu wrote :

IE 7 beta 2 has fixed that issue/possibility: you will never be able to
close a window which has not been opened via javascript. You never
should have been able to do this in the first place.
As a general rule, a script can never close a window which was not
opened via javascript.

In my case when I close the main window

Let's get into your perspective versus the users' perspective. The user
has a window which has a toolbar, a location bar, a status bar and a
menubar: all these are fully and completely under the user's control.
And you want a secondary window to open and to have no toolbar, no
location bar, no status bar, no menubar.

Do you think that your plan and design is user-friendly?

Gérard


Just a little tip if this is the case:
Have any site that links to your page use JavaScript to open up your
page, so that the script closing function will work. That might
override the function built in to IE 7 beta 2, or any other browser
that has that setting.

Submitted for your consideration.

I have the honor to remain your most humble and Ob't Sv't in our war
against the King.
 
M

micky b

use the follwong code to close main window, once the child window
succesfully opens

<script>
//popup window
function onLoad(){
window.parent.opener.close();
}

hope its help you

regards
mick
 
R

Richard Cornford

Just a little tip if this is the case:
Have any site that links to your page use JavaScript to
open up your page, so that the script closing function
will work.

By and large web sites want other people to link to them (that is a
major factor in where a page will show up in, for example, google search
result listings), and the want people to visit them (as they serve no
purpose at all if they are never viewed). Attempting to impose any
restrictions on the people who link to a site is going to discourage
them from linking to it, and insisting that those links are javascript
dependent (and so vulnerable to all pop-up blocking mechanisms) would
act to minimise the number of people able to follow such links
(discouraging visitors). A doubly counter-productive suggestion.
That might override the function built in to IE 7 beta 2,
or any other browser that has that setting.

Submitted for your consideration.
<snip>

It is a hackish suggestion attempting to mitigate the consequences of a
bad initial design decision.

Richard.
 
R

Randy Webb

micky b said the following on 5/14/2006 9:36 AM:

Please quote what you are replying to.

If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers.

use the follwong code to close main window, once the child window
succesfully opens

And then ask why it doesn't work.
<script>
//popup window
function onLoad(){
window.parent.opener.close();
}

And if that window wasn't opened with script, you will get a dialog (if
you are lucky and using IE) about security issues and some inept web
master attempting to close your window.
hope its help you

It didn't.
 
T

Thomas 'PointedEars' Lahn

micky said:

The required `type' attribute is missing:

//popup window
function onLoad(){
window.parent.opener.close();
}

The close tag is missing:

hope its help you

That is highly unlikely. For

a) If included as is, the function code is unlikely to be executed.
1. Invalid markup.
2. Wrong identifier. See b)

b) The function could have been called if the identifier was `onload'.
In that case, the identifier would overwrite the `window.onload'
event listener /iff/ properties of the Global Object would act as
properties of the Window object of the global execution context.
In that case, it would be identical to the rather sane

window.onload = function window_onload()
{
...
};

c) In that case, the parent window, unless opened through scripting itself,
will not be closed without showing a cancellation dialog to the user
first, due to security measures. Or the parent window, unless opened by
script itself, will not be closed at all silently, due to other security
measures.

d) If the opener was closed already, a script error is likely, as the
reference window.parent.opener is void then. If it or the popup window
shows a different (esp. deeper nested) frameset than before, either a
script error will occur or simply nothing happens then.


PointedEars
 

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
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top