473,385 Members | 1,218 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

need to close main window on child opens succesfully

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,m enubar=no,resizable=no,scrollbars=no,width=1000,he ight=400';
win =
window.open('/nxtt/jsp/main.jsp','_blank','scrollbars=yes,resizable=yes,m enubar=no,toolbar=no,status=no');
thanks for time

regards
Jaggu

May 11 '06 #1
7 2492
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,m enubar=no,resizable=no,scrollbars=no,width=1000,he ight=400';


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

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 11 '06 #2
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,m enubar=no,resizable=no,scrollbars=no,width=1000,he ight=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
--
remove blah to email me
May 14 '06 #3

Gérard Talbot wrote:
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,m enubar=no,resizable=no,scrollbars=no,width=1000,he ight=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
--
remove blah to email me

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.

--
Patrick Reilly
1st Coy.
Colonel Seth Warner's Regiment

May 14 '06 #4
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

May 14 '06 #5
pe********************@gmail.com wrote:
<snip>
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.
May 14 '06 #6
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.

<URL: http://www.safalra.com/special/googlegroupsreply/ >
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.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 14 '06 #7
micky b wrote:
<script>
The required `type' attribute is missing:

<script type="text/javascript">
//popup window
function onLoad(){
window.parent.opener.close();
}

The close tag is missing:

</script>
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
--
The English government is much of a German poodle as
other governments. The Germans infiltrated them all.
-- "The only real Barbara Schwarz", dsw.scientology,
<16**************************@posting.google.com >)
May 22 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Carol Lyn | last post by:
Could use your assistance with this. I have a window that opens via onclick and it is a small window with info about a site. If the user is interested in visiting that site, there is a link to...
10
by: olga p. | last post by:
Hi, I would like to close the browser window when I open the new one. Now I'm getting really irritation message: do I really want to close it, yes or no. I just want to close the browser without...
6
by: marcelf3 | last post by:
Hello.. This page opens a window with some information, but everytime the user changes a field in the parent window, the child window needs to be closed. These 2 functions were supposed to do the...
1
by: Samy | last post by:
Hi There, I have a child window opened from aspx page using window.open. On the child window, I have a button(New category) which opens a grandchild. I also have a cancel button on the child...
2
by: Paul | last post by:
Hi this is related to a previous post, hopefully just a bit clearer description o the problem. I have a parent form that opens a new form (child form) while still leaving the parent form open....
14
by: Paul | last post by:
Hi I have 2 functions in java script, one opens a second window-this works, the other is supposed to close this second window, does not seem to be working. Just wondering if anyone had any ideas....
2
by: Vijay Kerji | last post by:
Hi, Please go through the following scenario. 1)On Button click, Parent window opens a child window using showModalDialog 2)Button is a server control and showModalDialog script is registered...
1
by: saxtunes | last post by:
Hello, I have a problem I have been dealing with for a couple of days now.. any help would be greatly appreciated. I have an SDI Application that opens first with appearance of a Dialog box.. ...
1
by: michal.podlewski | last post by:
Hi All, I have a problem with a simple (as I thought till now) thing: I want to make a link in a child-window which would change site in the parent-window and along with closing child window. The...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.