Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove PDF cache history in PDF.JS #6185

Closed
sujit-baniya opened this issue Jul 8, 2015 · 3 comments
Closed

Remove PDF cache history in PDF.JS #6185

sujit-baniya opened this issue Jul 8, 2015 · 3 comments

Comments

@sujit-baniya
Copy link

Sir,
We are working on e-library where pdf.js is used to load the PDF files chunk by chunk. The file size of PDF is normally 16MB. AT first load of PDF.JS(disabling cache on browser), the pdf is downloaded in chunk. But as I refresh the page(withour disabling chache on browser), the PDF.Js downloads whole PDF instead of chunk.
For reference,
Browsing pdf with (cache disable):
working snap

But when the same PDF is stopped in the middle and reloaded again then, whole pdf is downloaded as:
not working snap

How can I make PDF.JS load the PDF file downloading chunk-by chunk even if I refresh the page multiple times?

@sujit-baniya
Copy link
Author

Is there any server-side configuration required to resolve this issue? It would be helpful enough if one could provide the necessary configurations on: SERVER or CLIENT so that the PDF would be loaded same as like as mozilla hosted PDF.JS( Every request is made with 206 Partial Content).

@yurydelendik
Copy link
Contributor

Is there any server-side configuration required to resolve this issue?

Yes, see https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching_FAQ for solution. PDF.js is using browser's XHR and has no direct control over request caching. Closing as answered.

@ctnitchie
Copy link

One way to disable caching client-side is to add a random or timestamp-based parameter to the end of the URL, e.g. viewer.html?file=some.pdf&_=someRandomNumberOrCurrentDatetime. This will cause the browser's cache to be bypassed, because the URL is always different.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants