logo-dw

Go Back   Dreamweaver Club Forums > Dreamweaver forums > Dreamweaver General
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 04-07-2011, 05:06 PM   #1
RainForest
RainForest's Avatar
 
Join Date: Mar 2008
Posts: 168
Default download link

Hello,

I'm trying to create a link that doesn't just open a pdf file, but actually prompts the user to download the file. Is there a way to do this?
RainForest is offline   Reply With Quote
Old 04-07-2011, 05:20 PM   #2
gentleone
gentleone's Avatar
 
Join Date: Nov 2009
Location: Rhodes, Greece
Posts: 2,837
Default

You can force a download dialog using PHP. Here's a neat article about the subject.
http://apptools.com/phptools/force-download.php
__________________
www.gentlemedia.nl
gentleone is offline   Reply With Quote
Old 04-07-2011, 06:36 PM   #3
RainForest
RainForest's Avatar
 
Join Date: Mar 2008
Posts: 168
Default

Thanks, gentleone. That's a comprehensive page. I've followed the instructions but still just get the pdf file to open in the browser instead of getting the download dialog. Am I supposed to modify the code somewhere?
RainForest is offline   Reply With Quote
Old 04-07-2011, 07:14 PM   #4
gentleone
gentleone's Avatar
 
Join Date: Nov 2009
Location: Rhodes, Greece
Posts: 2,837
Default

Can you post the code what you have so far, so I can have a look?
__________________
www.gentlemedia.nl
gentleone is offline   Reply With Quote
Old 04-07-2011, 07:48 PM   #5
Ricky55
Ricky55's Avatar
 
Join Date: Oct 2005
Location: West Yorkshire, UK
Posts: 1,855
Default

What browser are you using? I have some code that works in all browsers apart from Safari.

You could also zip the PDF that forces the download too but not ideal.

I would advise against doing this anyway though. Im never keen on altering the way a browser works for things of this nature. To my mind there's nothing wrong with the PDF just opening in the browser in fact it's more convenient. Unless it's a huge file.

Users expect the PDF to open and can be put off if asked to download something.
__________________
Qwerty Design

Check out my blog for web design insights.
http://www.qwerty-design.co.uk/
Follow me on Twitter: @QwertyDesignUK
Ricky55 is offline   Reply With Quote
Old 04-07-2011, 09:17 PM   #6
d a v e
 
Join Date: Feb 2006
Location: finland
Posts: 1,684
Default

and of course users can choose to right click and save as
d a v e is offline   Reply With Quote
Old 04-07-2011, 11:56 PM   #7
RainForest
RainForest's Avatar
 
Join Date: Mar 2008
Posts: 168
Default

gentleone, the code I posted is /exactly/ what appears in the link you provided.

Ricky, /my/ browser of choice is FF, but I also checked in IE & no go.
RainForest is offline   Reply With Quote
Old 04-08-2011, 03:42 PM   #8
domedia
Administrator
domedia's Avatar
 
Join Date: Dec 2003
Posts: 9,730
Default

Quote:
Originally Posted by Ricky55 View Post
I would advise against doing this anyway though. Im never keen on altering the way a browser works for things of this nature. To my mind there's nothing wrong with the PDF just opening in the browser in fact it's more convenient.
Just want to agree with this. Let the user decide how they want to approach it.
domedia is offline   Reply With Quote
Old 04-08-2011, 09:31 PM   #9
RainForest
RainForest's Avatar
 
Join Date: Mar 2008
Posts: 168
Default

I suppose it really makes no difference how the file is accessed. I wanted to make it a download because the associated link says "click here to download survey". They can't complete the survey in the web browser, so it's just an unnecessary step I was trying to avoid for the visitor.
RainForest is offline   Reply With Quote
Old 04-08-2011, 11:52 PM   #10
DWcourse
DWcourse's Avatar
 
Join Date: Apr 2009
Posts: 3,276
Default

Quote:
Originally Posted by RainForest View Post
I suppose it really makes no difference how the file is accessed. I wanted to make it a download because the associated link says "click here to download survey". They can't complete the survey in the web browser, so it's just an unnecessary step I was trying to avoid for the visitor.
Why not:

"right+click here to download survey"
__________________
If my answer helped, check out DWcourse.com for Dreamweaver tips and tutorials.
DWcourse is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:40 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com