469,946 Members | 2,064 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,946 developers. It's quick & easy.

Need solution to close browser window from ASPNET Page

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

Nov 30 '05 #1
2 1498
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

"OB" <obrignontainonet> wrote in message
news:Oj**************@TK2MSFTNGP09.phx.gbl...
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

Nov 30 '05 #2
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.

"OB" wrote:
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

Nov 30 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by tmb | last post: by
3 posts views Thread by Martin | last post: by
4 posts views Thread by Ron Lautmann | last post: by
10 posts views Thread by newbie | last post: by
2 posts views Thread by | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.