pdfmicrosoft-edgebrowser-cache

What can I do to change this Edge PDF frame behaviour without JavaScript (Firefox works OK)


Using this simple code I expected 1,2,3 to open a PDF at page 1 page 2 and skipping 3 to 4 get a page 404.

The raw HTML (in snippet below) works perfectly in Firefox in any order, page 1 is replaced by page 2 etc.

In Edge (possibly Chrome/ium) I need to go 1, 3, 2, for page 2 to appear, so presume it's some cache problem/setting?

Is it local to my settings? Or is it a common issue (have seen something similar with external address, on occasions). See my prior answer to another question https://stackoverflow.com/a/73986937/10802527

NOTE I have the PDF setting Open PDFs to last viewed location when you reopen files OFF

I do not wish to add JavaScript but will consider in-page CSS or browser user choices.

<body>
    Click the links (1 2 3). <br/>
    OR regular view, <a href="https://pdfobject.com/pdf/sample-3pp.pdf" target="_blank">pop-up test</a><br/>
    <a href="https://pdfobject.com/pdf/sample-3pp.pdf#page=1" target="if">1</a><br/>
    <a href="https://pdfobject.com/pdf/sample-3pp.pdf#page=2" target="if">2</a><br/>
    <a href="https://pdfobject.com/pdf/sample-3pp.pdf#page=4" target="if">4</a><br/>
 <iframe name="if" width="400" height="400"></iframe>
 </body>

I have trawled though dozens of change this or that cache setting even off in inspector, plus those in IExplorer and lots of in page <head meta> CSS options but none seem to work other than change the perceived address.

So, this works to force a fresh re-download?, but can't find any better:

<a href="https://pdfobject.com/pdf/sample-3pp.pdf#page=1&view=FitV" target="if">1</a>a<br/>  
<a href="https://pdfobject.com/pdf//sample-3pp.pdf#page=2&view=FitV" target="if">2</a>b<br/>

Solution

  • I test in Chrome and it has the same behavior as Edge. I think it's a chromium issue. It looks like cache problem in iframe and there's no setting in browser can fix this.

    As a workaround, you can add a unique query string parameter after the pdf url like this: https://africau.edu/images/default/sample.pdf?v=22222#page=2. Then the browser will cache each pdf version separately. You can refer to the following code:

    <body>
        Click the links (1 2 3). <br />
        OR regular view, <a href="https://africau.edu/images/default/sample.pdf" target="_blank">pop-up test</a><br />
        <a href="https://africau.edu/images/default/sample.pdf#page=1" target="if">1</a><br />
        <a href="https://africau.edu/images/default/sample.pdf?v=22222#page=2" target="if">2</a><br />
        <a href="https://africau.edu/images/default/sample.pdf=page=3" target="if">3</a><br />
        <iframe name="if" width="400" height="400"></iframe>
    </body>