Thursday, October 20, 2011

How to close the current tab in the browser in c#.net?

For this post, I am really thankful to Mr. K.Kathiravan, for finding the solution for closing the current tab of the browser with asking any confirmation. I need to close the current tab (if only one tab open then need to close the browser) while user click on a link (take an example of log out). I also do not want any confirmation message before closing that, since our requirement is to close the browser in any case.

Here is the code that I have written in the page load and it works for me.
Response.Write("<script language='javascript'>window.open('','_self');window.close();</script>");

No comments:

Post a Comment