Skip to content
Polyfill for the "History API: Scroll Restoration"
HTML JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist
.editorconfig Initial version Sep 22, 2015
.gitattributes Initial version Sep 22, 2015
.gitignore Build replaced. Embedded prevent-popstate-scroll Sep 16, 2016
.travis.yml
demo.html
index.js
license Meta Jul 24, 2019
package.json Meta Jul 24, 2019
readme.md

readme.md

scroll-restoration-polyfill

Prevent the scroll restoration caused by the popstate event or back/forward buttons. Demo

gzipped size Travis build status npm version

Warning: it works in Chrome, Safari, and Firefox 46+, but there's no IE/Edge support yet.

Usage

The polyfill has no API. Once included, just use the official API as described on Chrome Developers:

// Prevent the scroll, always
history.scrollRestoration = 'manual';

// Stop preventing the scroll
history.scrollRestoration = 'auto';

Install

Pick your favorite:

<script src="dist/scroll-restoration-polyfill.browser.js"></script>
npm install --save scroll-restoration-polyfill
require('scroll-restoration-polyfill');
import 'scroll-restoration-polyfill';

Links

Dependencies

Two lightweight dependencies, already included in scroll-restoration-polyfill's scroll-restoration-polyfill's gzipped size

License

MIT © Federico Brigante

You can’t perform that action at this time.