If you've ever tried to close a browser window from ASP.NET by using the following code:
<input type="button" class="inputfields"
You will probably receive the following message:
After digging around for 20 minutes or so, I finally found the answer on Anatoly Lubarsky's blog:
Because of the security enhancements in IE7, you can't close a window unless it is opened by a script. so the walkaround will be to let the browser thinks that this page is opened using a script then closing the window. below is the implementation.
Now you can try it by adding the below HTML code
<a href="" onclick="CloseWindow();">Testing Close Window</a>
Hope this post will help you.
For Mozilla Firefox
set your firefox browser:
1. input "about:config " to your firefox address bar and enter;
2. make sure your "dom.allow_scripts_to_close_windows" is true