473,703 Members | 3,032 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.ope n()" 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,dir ectories=no,loc ation=no,status =no,menubar=no, resizable=no,sc rollbars=no,wid th=1000,height= 400';
win =
window.open('/nxtt/jsp/main.jsp','_bla nk','scrollbars =yes,resizable= yes,menubar=no, toolbar=no,stat us=no');
thanks for time

regards
Jaggu

May 11 '06 #1
7 2512
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.ope n()" 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,dir ectories=no,loc ation=no,status =no,menubar=no, resizable=no,sc rollbars=no,wid th=1000,height= 400';


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

--
Randy
comp.lang.javas cript 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.ope n()" 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,dir ectories=no,loc ation=no,status =no,menubar=no, resizable=no,sc rollbars=no,wid th=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
--
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.ope n()" 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,dir ectories=no,loc ation=no,status =no,menubar=no, resizable=no,sc rollbars=no,wid th=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
--
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.o pener.close();
}

hope its help you

regards
mick

May 14 '06 #5
pe************* *******@gmail.c om 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.c om, 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.o pener.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.javas cript 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.o pener.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.o pener 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
9708
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 click that opens the site in a new and larger window via onclick. My question is, can I have the smaller window automatically close when the user clicks the link to visit the site? I also have a link that merely closes the smaller info window if...
10
2430
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 the message. Does anybody know the solution? greatings,
6
2740
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 work. Nota() - opens new window. fechaNota() - closes the window opened by Nota() here is the code.
1
3431
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 window which when clicked should close the child and the granchild windows. Can anybody suggest me how this can be accomplished. I am using image buttons to do this. This is how I am implementing, but for some reason the 'win' is undefined.
2
2904
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. Although the child form has a close button (with java script) if the user navigates the parent form to another form the child form is still open. Just wondering if there is a way to close the child form when the user navigates away with the parent...
14
2776
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. Here is the code, the functions are <script language="javascript"> function openwin(){ win_usr=window.open ("control_numinfo.aspx") } function closewin(){
2
1758
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 using the following code: string scriptblock = "<script language='javascript'>returnValue = window.showModalDialog('Datagrid1.aspx', 'xxx');" + "if(returnValue == 0) window.open('Webform1.aspx', '_self'); else
1
2588
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.. The Dialog DoModal code is located in the initialization application function of the main application code: CStatusDlg dlg; dlg.DoModal();
1
4509
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 parent window name is "main". A made a link like this in the child-site: <a href="new_address.html" target="main" class="about" onclick="javascript:main.location='new_address.html';self.close();"> change and close </a>
0
9251
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8963
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5922
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4433
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3125
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2453
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2069
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.