History.scrollRestoration
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
History.scrollRestoration
속성을 사용하면 기록 탐색 시 사용할 스크롤 위치 복원 기능의 기본값을 웹 애플리케이션이 지정할 수 있습니다.
구문
js
let scrollRestore = history.scrollRestoration;
값
예제
현재 스크롤 복원 여부 알아내기
js
const scrollRestoration = history.scrollRestoration;
if (scrollRestoration === "manual") {
console.log(
"The location on the page is not restored, user will need to scroll manually.",
);
}
스크롤 복원 비활성화
js
if (history.scrollRestoration) {
window.history.scrollRestoration = "manual";
}
명세
Specification |
---|
HTML # dom-history-scroll-restoration-dev |
브라우저 호환성
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
scrollRestoration |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.