Submit Your Article Forum Rules

Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: PDF won't update for end user

  1. #1
    Senior Member
    Join Date
    Jun 2004
    Posts
    105

    PDF won't update for end user

    I have a hyperlink on my webpage to a pdf. This pdf needs to be changed on a regular basis. Typically, I upload the new one to overwrite the old one.

    But then my website client says visitors are still seeing the old version. I suspect this is because they've been to the site before and are seeing a cached version in their computer.

    Is there any way in the html to force a refresh on load?

    I suppose I could change the name of the pdf each time (and change the html link) but this might just move the refresh problem to the linking page. I don't know if that's an improvement.

  2. #2
    Junior Member
    Join Date
    Jul 2003
    Posts
    12
    I do the same thing for a client when they update their quarterly PDF order form... except last month, people were still seeing the old one!

    Well, I HAD uploaded it - just to the wrong directory! Easily done especially when there are a mountain of updates to do all at the same time.

    The other problem is to do with the file name - i.e. orderform.pdf not the same as orderform.PDF, order-form.pdf, or OrderForm.pdf... so I have to ensure the same name is used each time.

    While these may not be the problem in your situation, it stresses the point about continually checking links to make sure you get the expected result

  3. #3
    Administrator weegillis's Avatar
    Join Date
    Oct 2003
    Posts
    5,788
    Unfortunately there is no way to clear a user's local history cache. What you might do is add a NEW badge beside the PDF link each time you update the file. Remove at some later date once it's been well distributed. You could include the recommendation to refresh the PDF file once it opens in their browser. This will overwrite the locally cached version in one fell swoop. No need to delete history or clear cache.

    In addition, there is probably a PHP approach to using HTTP Response Headers.
    Last edited by weegillis; 09-15-2010 at 07:42 PM.

  4. #4
    Senior Member
    Join Date
    Jun 2004
    Posts
    105
    Quote Originally Posted by weegillis View Post
    What you might do is add a NEW badge beside the PDF link each time you update the file.
    The problem with this is -- what if they're looking at a cached version of the HTML page, too? Then they won't see the "new" badge.

    Here's my plan:

    1) Datestamp the documents, so if a visitor sees an old one I can ask what date they see.

    2) New PDF uploads get a new file name. File1.pdf gets replaced with File2.pdf etc. The corresponding link gets changed and the old PDF gets deleted.

    3) Use a "pragma" meta tag on the linking page to prevent future visitors from mistakenly seeing their cache. This only helps with new visitors, not old ones who cached the old page, unfortunately. Details here: http://www.htmlgoodies.com/beyond/re...le.php/3472881

  5. #5
    Administrator weegillis's Avatar
    Join Date
    Oct 2003
    Posts
    5,788
    Question: are you PDF's being indexed? If so, you may wish to keep the same name on each update. At least that way, the SERPs will always be pointing to correct file.

  6. #6
    Senior Member
    Join Date
    Jun 2004
    Posts
    105
    Well, that's part of the problem, isn't it? I don't want old versions of the file showing up in searches.

  7. #7
    Member 3DGrunge's Avatar
    Join Date
    Jul 2010
    Location
    NC, USA
    Posts
    53
    If cache is the issue couldnt you use something like a php header to stop the browser from cacheing? I am not certain if it would work, but I think it should.
    HTML Code:
    <?php
    // Date in the past
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    header("Cache-Control: no-cache");
    header("Pragma: no-cache");
    ?>

    or force them to download the new .pdf file with something like
    <?php
    header("Content-type:application/pdf");

    // It will be called downloaded.pdf
    header("Content-Disposition:attachment;filename='downloaded.pdf'") ;

    // The PDF source is in original.pdf
    readfile("original.pdf");
    ?>

    Again I am not certain if this will work, someone else might be able to confirm or refute this.
    The nice part about being a pessimist is that you are constantly being either proven right or pleasantly surprised. ~George F. Will

  8. #8
    Senior Member
    Join Date
    Jun 2004
    Posts
    105
    Yes, I just started using the Pragma meta tag. (See above.)

    That second bit of code is new to me. I'd like to know if it will work before trying it out.

    Also is there an equivalent for straight HTML? Not all my websites are in PHP.

  9. #9
    WebProWorld MVP wige's Avatar
    Join Date
    Jun 2006
    Posts
    3,138
    What you are describing actually sounds like a symptom of a server misconfiguration - for some reason, the server is not properly communicating with clients about when the file was created. This could be because the modification date of the file is not changing, or it could be because the web server is not sending the proper headers.

    First, a couple of questions:
    Is the server Apache on Linux?
    How is the PDF file being put into its download location, through FTP or some other method?
    The best way to learn anything, is to question everything.
    WigeDev - Freelance web and software development

  10. #10
    Senior Member
    Join Date
    Jun 2004
    Posts
    105
    PDF files are always uploaded through FTP.

    The server is running Linux CentOS. I believe it's Apache, because I'm successfully using 301 redirects for other areas.

    (That gives me an idea... is there a way to solve this in an HTACCESS file?)

Page 1 of 2 12 LastLast

Posting Permissions

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