Force PHP download script pops up a blank page, is there a way to close it?
The PHP file is ran with headers to force a download (from flash/as3 project), but it also pops up a blank page. Is there a way to close that after?
I don't think users want blank p开发者_StackOverflowage popups springing up.
What I thought would work, but apparently not:
echo ("<script>window.close();</script>")
You can't echo
something since that's part of the output of the script producing the file they're downloading. You wrote that JavaScript into the file. There is no separate webpage where you can put code like that.
You take care of it on the code that's starting the download (tricky stuff like javascript writing a 1x1 pixel iframe pointing to the download URL) or accept that you don't control browser behavior like this.
精彩评论