Re: Form to page force download

From: Date: Fri, 21 Apr 2006 21:08:53 +0000
Subject: Re: Form to page force download
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-234517@lists.php.net to get a copy of this message
On Fri, April 21, 2006 1:53 am, Peter Lauri wrote: > 1. Fill out a form on a web page > > 2. Lands on a thank you page and force a download of a pdf > > Right now I solve this by outputting the thank you page and then using > a > javascript to redirect to the download.php that consist of the > following: > > header('Content-type: application/pdf'); > > header('Content-Disposition: attachment; filename="eguide.pdf"'); > > > readfile('http://www.thedomain.com/download/eguide.pdf'); > > Unfortunally it seams like some browsers blocks my javascript that > redirects > to that address. If JavaScript is enabled, this works fine. > > How would you solve this? Any method in PHP? I was hoping to be able > to do > the thing that download.php does in the same file as the output of my > thank > you page. Did you consider looking at the source to the download.php page? Cuz if that's what you want to do, then that's where you solution is. At a guess, I'd say you want to add a META HTTP-EQUIV=Refresh tag to your thank you page. I can't promise EVERY browser will support/honor it, but it does not rely on JavaScript and has a MUCH larger install-base than JS. Personally, I'd rather you just gave me a link to the dman PDF and put a little thank you next to it, so I don't have to waste my time surfing to your thank page to get what I want. [shrug] I believe that if you examine this from the user's point of view, you'll find that to be a nicer experience. -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#234517) next »