# Monday, August 31, 2009
Sometimes you need a control over browser window behaviour, i.e. open a new one and close it, eventually.

This is really simple. All you need to write is one liner code.

To open an window:
window.open ("http://www.google.com","window"); 
Then you can close it by:
window.close();
In ASP.NET you have variety of ways to achieve browser window close. One example:
closeButton.Attributes.Add("onclick", "window.close();")
By this, close functionality is dynamic added to the control event.

Important: you can close a browser window with code which was open by the code.

However, this open/close window java script technique is more or less obsolete. If you need to display a special "window" to the user, you should use modal windows. ASP.NET AJAX have a nice control, called "ModalPopup".

posted on Monday, August 31, 2009 7:24:45 AM (Central European Daylight Time, UTC+02:00)  #    Comments [0] Trackback
Related posts:
Validation service OnLine
ASP.NET Localization
EXECUTE permission denied
ASP.NET Response.Redirect("")