SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Keep Moving Forward gold trophysilver trophybronze trophy
    Shaun(OfTheDead)'s Avatar
    Join Date
    Nov 2005
    Location
    Trinidad
    Posts
    3,746
    Mentioned
    45 Post(s)
    Tagged
    0 Thread(s)

    Force .pdf Download

    I believe this is a Javascript question.

    I'd like to force a regular link to a .pdf to open up the download prompt when someone clicks (rather than have the usual Adobe plug-in launch).

    Is there a way to do this ?




    Trying to fill the unforgiving minute
    with sixty seconds' worth of distance run.

    Update on Sitepoint's Migration to Discourse

  2. #2
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You'd need to make a proxy script which accepts the name of the file you want to download, then have it send specific headers to the client. The php manual's entry for the header function has an example on how to do this (with pdf's even).

  3. #3
    SitePoint Addict
    Join Date
    Jan 2007
    Posts
    344
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As already mentioned, your solution is in a http header.

    Specifically, the mime-type header, and the file-disposition option for that header.

  4. #4
    Keep Moving Forward gold trophysilver trophybronze trophy
    Shaun(OfTheDead)'s Avatar
    Join Date
    Nov 2005
    Location
    Trinidad
    Posts
    3,746
    Mentioned
    45 Post(s)
    Tagged
    0 Thread(s)
    Jeez... it just had to be something complicated, eh ?

    Thanks for the info, guys. I'll do some research on it when I have time.






    Trying to fill the unforgiving minute
    with sixty seconds' worth of distance run.

    Update on Sitepoint's Migration to Discourse


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •