Re: Closing my Window after Download
| From: | PHP Junkie | Date: | Thu, 26 Aug 2004 12:14:56 +0000 |
| Subject: | Re: Closing my Window after Download | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-194769@lists.php.net to get a copy of this message | ||
Ave,
Trust me John, I would not post here without trying out "many" javascript
functions first. In fact, the reason I posted here is because I began to
think that a PHP script like that won't allow the window to close, because
from window.close() to self.close() to various "Timeout & Close" scripts,
I've tried many javascript functions. I don't get any errors ... The window
just doesn't close...
On 8/24/04 2:09 PM, "John Nichel" <john@kegworks.com> wrote:
> PHP Junkie wrote:
>> Ave,
>>
>> The browser window which launched the Save As window...
>
> PHP cannot do this. You'll have to use JavaScript in the browser
> window. Something like....
>
> <?php
> $file = "$P/$F";
> header("Content-Description: File Transfer");
> header("Content-Type: application/force-download");
> header("Content-Disposition: attachment; filename=".basename($file));
> @readfile($file);
> ?>
> <script language="JavaScript">
> window.close();
> </script>