Need solution to close browser window from ASPNET Page

  • Thread starter Thread starter OB
  • Start date Start date
O

OB

I want to be able to press a button on the Browser page and close that
browser window.

Anybody has a sample for ASP.NET 2.0?

Thanks
OB
 
This can be achieved only by a javascript call window.close(). You can
either have a bit of javascript inside your .aspx file or emit this call
from code-behind.

Eliyahu
 
This does what you are looking for:

<input type=button value="Close Window" onclick="window.close();">

If the current window was not created by script (that is, via
window.open()), close() method will display a prompt to the user. This is a
security measure.

Hope this helps.
 
Back
Top