Ken Jenningson
Ken Jenningson

Reputation: 109

How to force user to refresh cache

So I'm trying to update my site's pdf forms, but when I changed them in my server, my users only see the old forms.

Is there a way to automatically force them to refresh the cache so they will see the new files?

Upvotes: 8

Views: 28148

Answers (2)

Eugene
Eugene

Reputation: 2878

Please check if you have caching for your static files on the server (is there some kind of CDN like Cloudfront is used? If yes then it could be checking for updates files once in a given period only).

You may also may control caching on the server-side by sending the Cache-Control header to no-cache, must-revalidate (see this for more options)

Upvotes: 2

Arun Sharma
Arun Sharma

Reputation: 1331

You can't force user's browser to clear cache from your website. Just change your pdf name and update it's link in your html accordingly when you replace it. This will prevent browsers from loading it from cache.

For instance, if you have a file named form1.pdf and want to replace it with updated version, delete form1.pdf (don't simply replace), name your new file a different name like form1a.pdf & update existing link to point to form1a.pdf.

Upvotes: 14

Related Questions