-
JavaScript: How to Close Browser Window (window.close()) Without Warning
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>
Customization, Development, Dynamics CRM 8,374 views7 responses to “JavaScript: How to Close Browser Window (window.close()) Without Warning”
-
SathishKumar January 24th, 2008 at 04:19
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();
} -
Shahriar Sayed March 11th, 2009 at 00:51
Thanks a lot Mani.
It works nicely in IE7.
-
RaiulBaztepo March 28th, 2009 at 18:26
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 -
Cesar Alpendre March 2nd, 2010 at 09:44
To close a window without warning message, try this:
Leave a reply
-



