Re: Closing my Window after Download

From: Date: Mon, 30 Aug 2004 20:56:03 +0000
Subject: Re: Closing my Window after Download
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-195207@lists.php.net to get a copy of this message
Ave, It still doesn't work. Not only that, I put up a "close window" button in the page and even that doesn't show up. Although that's still not what I want. What I want is the window to close automatically. Here's my page: <?php $file = "$P/$F"; header("Content-Description: File Transfer"); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=".basename($file)); @readfile($file); ?> <html> <head> <title>D/L Window</title> <script language="javascript"> 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) } </script> </head> <body onLoad="close_opener();"> <center><form><input type="button" value="Close Window" onClick="window.close();"></form></center> </body> </html> I don't know what to do... The page just won't close. > > 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

« previous php.general (#195207) next »