Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 23rd, 2004, 07:54 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

close Method
This method is used to close a specified window. If no window reference is supplied, the close() method will close the current active window. Note that this method will only close windows created using the open() method; if you attempt to close a window not created using open(), the user will be prompted to confirm this action with a dialog box before closing. The single exception to this is if the current active window has only one document in its session history. In this case the closing of the window will not require confirmation.

Hope that helps.
Cheers!

_________________________
-Vijay G
Strive for Perfection
 
Old June 23rd, 2004, 08:01 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

You can try this for testing the second case said in my previous post regarding "only one document in its session history".

http://www.internet-nexus.com/books/vbscript/chap05.htm

1) open this URL.
2) scroll till the end of the page. (under Closing the browser window)
3) Do a SHIFT + mouse click on "close method" link there. Then try closing that new window resulted, from this step by clciking the button shown there. This does not ask for confirmation
4) Try clicking the "close method" link on that page without "SHIFT KEY press". Now, in this method, it would ask for confirmation to close the browser window.

Hope that explains.
Cheers!

_________________________
-Vijay G
Strive for Perfection
 
Old June 23rd, 2004, 08:18 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

hello happygv,

Just for an interest sake. Is there any way to prevent the confirmation from appearing (if the window is not opened with the help of window.open method / target=_blank) ?

thanks
 
Old June 23rd, 2004, 08:26 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

AFAIK, I dont think that is possible. May be someone come up with a work around for that, still that could be a rare possibility, as it is about controlling the behaviour of the browser.

You can, if its session history has just that one document, like you see here in this p2p.wrox website, when you subscribe to a forum/topic, that opens up a new window saying you are subscribed, and that closes without any confirmation, as it has just that one document in its history.

Cheers!

_________________________
-Vijay G
Strive for Perfection
 
Old June 23rd, 2004, 11:57 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

There is a secret way to close the window without the prompt box, it uses JavaScript.

window.opener=top;
window.close();

Redirect to the user's home page:

location.replace("about:home"); //dont enter into history, or...
location = "about:home"; //do enter into history

HTH,

Snib

<><
 
Old June 23rd, 2004, 11:35 PM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

Hi snib,

Thanks a lot for the so simple solution. This makes me satisfy a long sought request of one of my client.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Browser close when screen saver close Rehanrana Pro VB 6 1 April 7th, 2008 03:09 AM
How to close browser window? rupen Javascript How-To 14 July 31st, 2006 10:52 AM
handling script errors using vb web browser state Beginning VB 6 3 January 19th, 2006 09:01 AM
trying to close browser in a button taliosfalcon ASP.NET 1.0 and 1.1 Basics 1 February 7th, 2005 12:11 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.