I have a file, named download.php
, which contains a file to be downloaded, so it has the following headers (declared with PHP):
header(\"Content-Typ
Can I ask what it says in the browser url bar in this opened window. It might be the case that the browser see's the headers letting the browser know it is to be treated as a download and doesn't run the window as a true page. and instead opens something like 'about:blank'. If that's the case the on the page javascript would never get run.
I can suggest the following however. I'm assuming this window is being opened by another page. In that case have the other page open the window programatically through javascript and control the close from there.
var popout = window.open("http://example.com/download.php");
window.setTimeout(function(){
popout.close();
}, 1000);