If you've ever tried to close a browser window from ASP.NET by using the following code:
<input type="button" class="inputfields"
onclick="javascript:window.close();" value="Close" /></td>
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:
<input type="button" class="inputfields" onclick="javascript:window.opener='x';window.close();" value="Close" /></td>




Hi,
This doesnt work in IE7 and Firefox 2.0.Any help thanks
Try
window.opener = self
window.close()
Still get message asking if you want to close the page.
function OpenMyWin()
{
window.opener='X';
window.open(",'_parent',");
window.close();
}
Thanks a lot Mani.
It works nicely in IE7.
Hello!
Very Interesting post! Thank you for such interesting resource!
PS: Sorry for my bad english, I'v just started to learn this language ;)
See you!
Your, Raiul Baztepo
To close a window without warning message, try this:
Close Window
write these lines on button click.
response.write("(window.close;)")
window.onfocus = function() {window.open(", '_self', "); window.close(); }
function closeMe()
{
var win=window.open("","_self");
win.close();
}
then
please 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