At 09:14 AM 8/26/2004, PHP Junkie wrote:
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" <[EMAIL PROTECTED]> 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>
Here, try this JS:
function close_opener()
{
parentwin = window.self; // Make handle for current window named "parentwin"
parentwin.opener = window.self; // Tell current window that it opened itself
parentwin.close(); // Close window's parent (e.g. the current window)
}
HTH - Miles Thompson
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php