How to manage and clean the file cache so we can load up different files each time even if they have the same URL?

PDF.js Express Version

Detailed description of issue
Hi team ,
Is there any way to manage and clean the pdfjs file cache so we can load up different files each time even if they have the same URL? I can see there are a lot of pdfjs files that are being stored on local storage as well. Is there any way to reduce this cache?

Expected behaviour
{Provide a screenshot or description of the expected behaviour}

Does your issue happen with every document, or just one?
{Answer here}

Link to document
{Provide a link to the document in question if possible}

Code snippet
{Provide a relevant code snippet}

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:


Hi there,

You should have no issues loading documents from the same URL. I just tested this and had no issues - are you running into problems?

Re caching - we do not cache files in the browser. Can you tell me which cache you are looking at?


Hey Logan !
Yes , we were having some trouble in getting the file updated if the pdf url was the same. To handle this currently we have changed our file name on every update but is there a way to handle this with the same url? Also, i was looking at the localstorage and saw that the pdf details were getting stored over there.



We don’t store any document info in localstorage, but we do save some state about the UI in localstorage. This can be disabled by calling instance.disableFeatures([instance.Feature.LocalStorage]). Note that disabling this may cause some bad UX for your users as their UI state won’t be preserved.

Regarding your issue about loading files with the same URL, I cannot reproduce this problem. I set up a local server that serves a random file from the same URL, and there is no cacheing issues or anything like that (everything behaves as expected). I believe this issue may be coming from your file server and might be some caching thing on your end.