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

Prevent scrolling to the top of the page on websocket reload #1097

Merged
merged 1 commit into from
Nov 19, 2019

Conversation

dylanowen
Copy link
Contributor

When using mdbook serve with large files, it's tedious to have to scroll back to the bottom of the page on each reload triggered by the websocket.

The problem stems from location.reload(true), which I've changed to location.reload().

However we still want to always load a fresh version of the page. To fix this I've added the header Cache-Control: no-store, max-age=0 in the server response.

Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and it works as we wish. Awesome improvement.

@ehuss I thinks this could be merged. Thanks.

Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This is so much nicer!

@ehuss ehuss merged commit 554f297 into rust-lang:master Nov 19, 2019
@dylanowen dylanowen deleted the cache branch November 21, 2019 06:33
Ruin0x11 pushed a commit to Ruin0x11/mdBook that referenced this pull request Aug 30, 2020
Prevent scrolling to the top of the page on websocket reload
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

Successfully merging this pull request may close these issues.

3 participants