I have a file, named download.php, which contains a file to be downloaded, so it has the following headers (declared with PHP):
download.php
header(\"Content-Typ
You may use the following snippet to close the current window (credits to this SO answer) :
window.open(window.location, '_self').close();
To run this after a given interval, simply use setTimeout
setTimeout
setTimeout(function() { window.open(window.location, '_self').close(); }, 3000);