Viewer history enable/disable control is broken
See original GitHub issueSupposedly it is possible to disable pdfjs viewer restoring viewer state by setting disableHistory
to false (is this key even documented anywhere?), but it’s not working at all.
Adding #disableHistory
to URL in the viewer does disable the history, but that’s caused by a bugged handling: adding any non-empty hash to the URL will cause history to be disabled.
Meanwhile, trying to set disableHistory
through defaultOptions
or AppOptions
does nothing. The only place where it’s used is inside _initializePdfHistory
, but it isn’t doing anything there either since pdf.history
will be created regardless.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
How to enable/disable the Session Inactivity Timeout
In the Session timeout section of the window, click Disconnect sessions if idle: and specify a time from the list. Click Save to...
Read more >Media Request Overview and Guide | StreamElements
You can add your own media via the 'Add media' button, review past requests by pressing 'History' or remove everything via the remove...
Read more >Fix site display issues with Compatibility View in Internet ...
To clear the list of Compatibility View sites. Open Internet Explorer, select the Tools button , and then select Internet options. Under Browsing...
Read more >Find & control your Web & App Activity - Android
Learn how to manage and delete on-device Search history. What's saved as Web & App Activity. Info about your searches and other activity...
Read more >Disabled UIButton not faded or grey - Stack Overflow
This is not working for view's background color. In my project I combined previous answer and this. – Anton. Mar 20, 2017 at...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That option only controls the browsing history implementation, i.e. https://github.com/mozilla/pdf.js/blob/master/web/pdf_history.js, which allows you to use the back button in the browser to navigate to a previous position after e.g. clicking on a LinkAnnotation within a PDF document.
Yes, it most certainly does exactly what it’s supposed to!
Based on the quoted code your question isn’t actually about
PDFHistory
but rather aboutViewHistory
(which is a separate thing, that only stores the last position inlocalStorage
and nothing else). That implementation is controlled by theviewOnLoad
option/preference, with the following currently supported values: https://github.com/mozilla/pdf.js/blob/d02233361872d3758eb23ed394c939c4f510e2cb/web/app.js#L89-L93Hence setting
viewOnLoad = 1
is sufficient to discard any view and/or browser history entries and always load all documents at the first page (and with default zoom values).For future reference: When opening an issue, please remember to provide all of the information requested in https://github.com/mozilla/pdf.js/blob/master/.github/ISSUE_TEMPLATE.md
Furthermore, this issue required some amount of “reading between the lines” to figure out what you really were asking about; hence please see https://github.com/mozilla/pdf.js/blob/master/.github/CONTRIBUTING.md (emphasis mine):
I downvoted because while it answers the question, it also dodges the underlying issue of the lack of documentation about viewer configs (what config should I change to achieve anything different from default behaviour?). I am customizing the existing viewer and I find myself often needed to dive into the initialization logic itself just to understand where should I change the code (and then guess wrong, just as this issue has proven). I don’t think this is encouraging to customizing the default viewer.