MSIE: “The web page you are viewing is trying to close the window”
Monday, April 28th, 2008The trials and tribulations of Internet Explorer can make the hardiest of us want to cry. When you code intranet applications, you often use new windows to simulate forms and whatnot. Yet MSIE7 loves to warn the user when the owner of the popup tries to close the very popup it opened!
Mostly it’s just an annoyance, but some non-techie users can be confused by the message as well.
Want to close your own darn window without prompting the user? Use this cheater script. I’ve only tested it on Trusted sites, so no promises about Internet Zone sites, mmkay?
<script type="text/javascript">
function closeMe()
{
window.open('','_self','');
setTimeout("self.close();",1000); // 1 second
}
</script>

