i want to save and access a pdf file from browser cache
i am using iframe to show pdf file from server, i want to focus different pages in it, by passing th开发者_Go百科e page parameter like a.pdf#page=5, but when i do this, it downloads the complete pdf from the server and then puts focus to page 5, how can i avoid this.
Ideally i want it to load from cache, can anyone help me out? thanks
Remove page=5. That is used to make the PDF plugin move to page 5. If you don't use it, the PDF page 1 will be displayed.
if the PDF is served from a server under your control, you can set the expires date of the header of the response to a far off date in the future, and send an etag (say, the hash of the pdf contents). Then, when ever you attempt to serve the PDF from the server, check that the request's etag header is set, and if it is, compare it with the hash of the PDF file, and if it is equal, send a 304 not modified status code (instead of the actual content). That should cause the browser to load it from cache if it exists.
精彩评论