Page 1 of 1
Download leavin a blank screen
Posted: Mon Dec 05, 2005 6:41 am
by hame22
Hi
I have set up a script to download a pdf file:
Code: Select all
$size = filesize($path);
$file = basename($path);
header ("Content-Type: application/octet-stream");
header ("Content-Type: application/download");
header("Content-Disposition: attachment; filename=$file");
header("Content-Length: $size");
readfile($path);
It works fine but when used in mozilla and some versions of explorer i get a blank browser left after it has been downloaded, is there anything i can do to remove this?
thanks
Posted: Mon Dec 05, 2005 6:47 am
by Chris Corbyn
Apart from not opening the download in a popup then you could use JS to automatically close the window... the problem being that you need to work out when the download is complete. It's the default behaviour for Mozilla FF.
Posted: Mon Dec 05, 2005 7:13 am
by hame22
how could i go about not opening this download in a pop up?
I realy want to remove this blank screen as my users do not like it
thanks
Posted: Mon Dec 05, 2005 7:23 am
by Chris Corbyn
hame22 wrote:how could i go about not opening this download in a pop up?
I realy want to remove this blank screen as my users do not like it
thanks
Sorry I was assuming you were doing something like
Code: Select all
<a href="?download" target="_blank">Click to download</a>
Which forces the download to open in a new window. In IE that closes as soon as the download dialog appears. In FF however it remains open. How are you initiatiing the download on the client side? I've not seen the blanks screen in FF other than when using popup windows.
Posted: Mon Dec 05, 2005 7:28 am
by hame22
that is how I am doing it, is there a better way to do this?
thanks for your help
Posted: Mon Dec 05, 2005 7:44 am
by Chris Corbyn
Just leave out the target="" attribute. The window location will not change but the save dialog box will open

Posted: Mon Dec 05, 2005 8:32 am
by hame22
haha, lovely jubbly