Need solution to close browser window from ASPNET Page

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
 
E

Eliyahu Goldin

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
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top