Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 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 December 6th, 2005, 02:01 PM
Authorized User
 
Join Date: Nov 2005
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default close window with out message box

Rather dumb simplistic question.
I have an aspx 1.1 application that runs in its own pop up window.
I have a close window button on my aspx application with
on click event of:
Response.Write("<script language='javascript'> { self.close() }</script>")

My simplistic question is can I get the application to simply
close "with out the message box requiring a yes or no" to close.
Again my application runs in its own pop up window.


 
Old December 6th, 2005, 03:08 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

window or self .close() should be enough.

So you are getting some kind of alert window? What are the details? You shouldn't be getting any alert window under normally opened windows. I think I know what you are referring to however.

Try the following javascript:

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

I think the problem lies with when the browser sees window.opener == null. It recognizes this as the topmost window and prompts for close confirmation. By setting the opener, you trick it so it doesn't prompt.

-Peter
 
Old December 6th, 2005, 04:26 PM
Authorized User
 
Join Date: Nov 2005
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you very much.
Yes I was getting an message box upon close.

I now no longer get the message box.
The following worked very well in my aspx close button event:

Response.Write("<script language='javascript'> { self.opener = top; self.close() }</script>")







Similar Threads
Thread Thread Starter Forum Replies Last Post
close window with out message box cesemj ASP.NET 1.0 and 1.1 Basics 10 October 2nd, 2007 09:23 AM
window.close() failing to...well...close! mheathcote Javascript How-To 2 October 31st, 2005 03:02 PM
Programmatically close a message box 12th_Man VB How-To 3 June 25th, 2004 05:44 PM
Close Parent window on opening child window pkdev Javascript How-To 8 April 11th, 2004 12:06 PM
How do i close pop-up window?: window.close () Burton HTML Code Clinic 2 September 8th, 2003 05:40 AM





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