页面刷新不定位到之前的滚动位置

history.scrollRestoration支持下面两个属性值:

  • auto 默认值,表示滚动位置会被存储
  • manual 表示滚动位置不会被存储
if (history.scrollRestoration) {
    history.scrollRestoration = 'manual';
}

  

posted @ 2023-01-30 16:02  671_MrSix  阅读(13)  评论(0编辑  收藏  举报