- 问题: 在chrome访问一个带hash的url, 执行滚动到页面上存在的某一个元素的位置, 每当刷新页面会出现回滚的现象
- 解决方案: history.scrollRestoration = ‘’manual’, 把chrome自动记录改成手动
history-api-scroll-restoration
code:1
2
3
4if ('scrollRestoration' in history) {
#// Back off, browser, I got this...
history.scrollRestoration = 'manual';
}