See my answer to this other question . You should be able to easily adapt it from ASP.NET to regular HTML.
Basically, since mozilla will let you close the window open by js, you can open a new window and set the target:
window.open('close.html', '_self', null);
now your window was opened by js, and you can close it with js! :) close.html:
<html><head>
<title></title>
<script language="javascript" type="text/javascript">
var redirectTimerId = 0;
function closeWindow()
{
window.opener = top;
redirectTimerId = window.setTimeout('redirect()', 2000);
window.close();
}
function stopRedirect()
{
window.clearTimeout(redirectTimerId);
}
function redirect()
{
window.location = 'default.aspx';
}
</script>
</head>
<body onload="closeWindow()" onunload="stopRedirect()" style="">
<center><h1>Please Wait...</h1></center>
</body></html>
source
share