Remember view position after refreshing the page
See original GitHub issueCurrently the view position is saved by a hash based on the file contents. When the page reloads, we should also take the last position into account, because it matches the normal behavior of browsers. Usually, when you reload a web page, the scroll offset is restored (even if the content of the page changed).
The motivation for this change comes from experiencing the following broken workflow:
- Generate a local PDF file (
file://....pdf
). - Open PDF with PDF.js and scroll to some chapter in the PDF file.
- Edit PDF file.
- Refresh the PDF.js viewer (e.g. with F5).
- Expected result: Retain the scroll position.
Actual result: Page 1 is shown in the viewport.
Technical notes:
performance.navigation.type
can be used to detect page reload versus navigations.history.state
is preserved when a page reloads.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:34 (7 by maintainers)
Top Results From Across the Web
Refresh Page and Keep Scroll Position - javascript
//code to refresh the page var page_y = $( document ). ... To fix this issue, I am removing the scroll position after...
Read more >How to keep the displayed position after page refreshment?
In an .aspx page, I use <meta http-equiv="refresh" content="10;"/> to refresh the page in order to update data. After each refreshment, the browser...
Read more >005 – Restore screen position after refresh - YouTube
Learn how to restore your scroll position, when using Oracle Application Express, after a Dynamic Action refreshes a report.
Read more >Video: 005 – Restore screen position after refresh
Save the scroll position of the page before you open the modal page. Restore the scroll position after the refresh. Here are the...
Read more >Save last browsing location when page is refreshed?
I'm working on creating a website and need to refresh it several times to ... previously viewing after refreshing at the middle of...
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
@ankitverma2211 If possible, tests would be great. However, we don’t have automated tests for this kind of features, so if the patch looks reasonable and passes a manual test, then we would accept it too.
I submitted a similar issue #11359 with respect to *latex-generated pdf. It is actually not correct that this uses a “hash based on the file contents” @Rob--W. Rather, it is an ID embedded in the PDF upon creation, and how that ID is generated depends on the generating application, for *latex it is a hash based on the combination of the current time and the pathname of the tex-file. See my last comment there for a solution.