473,770 Members | 4,718 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

close current window using window.close()

Hi,
When I want to close the current window using window.close() in IE6.0,
there will be a confirm box that: The web page you are viewing is trying
to close the window. Do you want to close this window?
I have to click yes to close the window.
How can I close the current window directly without this dialog box?

Thank you.
Sep 1 '05
10 38017
Randy Webb wrote :
Gérard Talbot said the following on 9/1/2005 12:54 PM:
Randy Webb wrote :
ewosch said the following on 9/1/2005 3:44 AM:

This alert occurs only if there is only one window and cannot be
switched off.


That is far from the truth.

It does work if there are more than one window.
It *can* be switched off.

That's is already mentioned in MSDN documentation too.

Where?


"Using script to close the last running instance of Microsoft Internet
Explorer also opens the confirmation dialog box."
http://msdn.microsoft.com/workshop/a...asp?frame=true
People way over-want to kill opener windows but this goes against the
best
interests of the users.

That depends on the user I guess.


I make a general rule, a generalization if you prefer, from this.
Any/every window has a system command close [x] button on the titlebar.
So why do scripters need to provide me with links, buttons, etc.. to
close that window. If I can open a new window on my own, I certainly can
close a secondary window on my own. Same thing with closing the internet
connection, shutting down the PC, closing the tv, etc.. I do not need
any additional, extra help in managing (open, resize, move and close)
windows which should be under my complete and entire control to begin
with. Browser manufacturers (Mozilla, Opera, Microsoft, Safari,
Konqueror, etc) understand such perspective and agree with it and they
are providing users with veto powers over script methods like open(),
resizeTo, moveTo, resizeBy, resizeTo, close, etc..
Expect MSIE 7 to put an end to all this (wink) and expect your scripts
to fail closing such IE 7 windows.

Somehow, I doubt it but would be totally shocked if it does. Considering
that IE has had that bug since IE5 or so, and it hasn't been fixed
through 3 versions, I don't see them fixing it now. That would require
MS to admit they had flawed software and actually fix it.


They can fix the bug without admitting anything seriously detrimental
too; security is a concern for all browser manufacturers and for
web-aware software makers. I created a page back 1-2 years ago with your
own data, Randy:

http://www.gtalbot.org/BrowserBugsSe...penedByJS.html

and then posted a request (see/search for: "opener property should be a
read-only property") in that sense at:

http://channel9.msdn.com/wiki/defaul...plorerSecurity

I also made sure Opera dev. is aware of this close() issue.
Mozilla-based browsers already deny the capability to close such
windows;

Don't bet on it.


Current Mozilla-based browsers do deny the capability to close such windows.
The default setting of dom.allow_scrip ts_to_close_win dows in
about:config is false.

reasonable and responsible web designers don't try to close
non-script-initiated windows.

"reasonable and responsible web designers" don't use secondary windows,
so they have no need to close superficial windows.....


I would add one nuance to such statement but I'd rather not since I
fully (general rule) support this opinion.

Gérard
--
remove blah to email me
Sep 2 '05 #11

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

Similar topics

3
5863
by: Bernd Liebermann | last post by:
Hi, I'm trying to change the content of an existing window from a second window using window.open(). This works fine in Netscape 7, but IE 6.0 returns an error, saying there's an invalid parameter. If I omit the target window's name, everything works fine except that my document is opened in a new window. window.open("somescript.php", "existing_target_window");
1
3373
by: gopal srinivasan | last post by:
I need to know how to close a parent modal window when child modal window opens, also i need to know the syntax for writing document on the modal window on the fly, like what we do in case of normal window. Actually, I tried to close the parent window from the child modal window using parent.close syntax in onload event in child modal window. It actually closes the parent modal window, but the child modal window is not opened, why it is...
2
5096
by: mamin | last post by:
Hi, I need to send a file to a client and then close current window. My code looks as follows: Response.ContentType="application/bmp"; Response.AppendHeader("","attachment; filename=\"" + bmpFilePath + "\""); Response.WriteFile(bmpFilePath); Response.Flush();
3
4547
by: dibakar | last post by:
Hello I want to open a window using Window.showModalDialog once i click inside of a TextBox.And that window need to come just under the TextBox,so that it seems to a same control. So,what will be its code in javascript?
7
3356
by: tapanreddy | last post by:
I am looking to perform an action when we close the window using the close tab at the top of the screen. I know how to do it using a close button but I was wondering if there is way to achieve the above. Waiting for some suggestions Thanks
5
2596
by: kalyangvd | last post by:
Hi Guys, I am trying to get the Field Id from the Parent Window in the pop up window using window.opener ex: var var1 = window.opener.document.getElementById("text1").value; alert(var1); I also used as window.opener.document.loginForm.text1.value but the field value is not getting in the pop up window. What am i missing here. Please let me know what i am missing here.
6
1542
by: tabakaka | last post by:
what is the condition if i want to pop a new window once i close the current one? is it..? if window.close { window.open("abc.aspx", "abc", 'toolbar=0,scrollbars=1,location=0,statusbar=yes,menubar=no,resizable=no,width=800,height=220,left=100,top = 145'); } i've tried it. but it didnt work.
2
3525
by: neha shah | last post by:
i have an aspx page in which a link in the grid view opens a popup page . the data in the grid view would be dynamic and i need to send the id of the row of grid while calling the child window. i get the id using sender.id, but how would i send this using window .open()?
0
9432
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10232
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
8891
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...
1
7420
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5313
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
5454
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3974
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
3578
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2822
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.