1

I have a webpage which has a link to a PDF file. Every time I update the PDF file, Internet Explorer will not load the updated file; it keeps showing the old file, even if I refresh the page. At this time, the only way it will show the updated file is for me to change the file name (of the PDF file), but that is troublesome since I update this PDF file often.

Does anyone know what to do?

  • You could try changing your URL to foo.pdf?revDate=20130916 – dcaswell Sep 16 '13 at 14:15
  • @dcaswell, you mean add foo.pdf?.... At the end of the URL containing the file? Can you be more specific? thank you. – user31266 Oct 7 '13 at 23:16
2

If you change the parameter on the end of a URL, browsers will "know" not to cache the result.

Rather than change the name of the PDF you can just add a parameter onto the end of the URL that references it.

First: foo.pdf?revDate=20130916 and then foo.pdf?revDate=20131007 etc.

2

If you've got some kind of control over said site you should indicate the file is not to be cached by stating so in the headers. The basic headers (in pseudo, for HTML/1.1) you'd need would be:

Pragma: no-cache
Cache-Control: no-cache, must-revalidate
Expires: {current_time}

For more info on the first two headers look at RFC2616 14.32 Pragma and 14.9 Cache-Control. Info on the Expires header as well as the format of the time with which to replace {current_time} can be found in chapter 14.21 Expires of that same specification.

FYI: Setting these headers will - of course - not force an already cached file (in your case: a previously viewed one) to be reloaded without you forcing it to do so (e.g. by emptying your cache).

1

Internet Explorer Caches the file and it doesnt delete it in the normal Delete Browsing History. You have to go to the Browser History Settings -> View Files locate the file and delete it manually.

However I found this to work on IE. Modifying the htaccess.

<IfModule mod_expires.c>
  # Enable expirations.
  ExpiresActive On

<FilesMatch ".(pdf)$">
  Header set Cache-Control "max-age=0"
</FilesMatch>

</IfModule>
0

Internet Explorer has already downloaded the file, so telling it to download it again only results in opening the file already downloaded. You can check where Internet Explorer is downloading the file to and delete it before downloading and opening a new version of the file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.