I try to set up a simple logoff-page which should close after 3 seconds.
Regarding this Question is it possible to wait before that action?
<script type="text/javascript">
sleep(3000);
window.open('', '_self', '');
window.close();
</script>
With the sleep nothing happens at all.
Edit:
The solution of @Sidius works well in IE without a prompt.
Unfortunately Firefox blocks the Script:
Scripts can not close any windows that were not opened by the script
try this:
window.open('', '_self', '');
setTimeout(function(){
window.close();
}, 3000);
Edit: I think firefox might be a little more strict with the
window.open()
function. You might want to give values to the function's constructor.
window.open(URL,name,specs,replace);
In example:
window.open("", "", "width=200, height=100");
You can use setTimeout() API to achieve the same -
setTimeout(window.close,3000);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With