Re: Closing my Window after Download

From: Date: Mon, 30 Aug 2004 23:13:53 +0000
Subject: Re: Closing my Window after Download
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-195225@lists.php.net to get a copy of this message
if you're not getting any html after your php script, then there's a different problem. I do the same thing and all I use is: <?php ... ?> <script language="javascript"> <!-- window.close(); //--> </script> and I've never had a problem with it not closing... -- -------------------------------------------------------------->> Jasper Howard :: Database Administration Velocity7 1.530.470.9292 http://www.Velocity7.com/ <<-------------------------------------------------------------- "Php Junkie" <phpjunkie@mjimm.com> wrote in message news:BD590CA3.1C9E%phpjunkie@mjimm.com... > 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 (#195225) next »