Chrome remembers scroll position

后端 未结 5 815
情话喂你
情话喂你 2020-12-05 04:52

I\'m running into a problem that\'s actually a \"feature\" on Chrome. As most of you might know, Chrome remembers a scroll position that it returns to, whenever you come bac

5条回答
  •  爱一瞬间的悲伤
    2020-12-05 05:29

    In Chrome 46+, the auto scroll behavior can be turned off using history.scrollRestoration:

    if ('scrollRestoration' in history) {
      history.scrollRestoration = 'manual';
    }
    

    source: https://developers.google.com/web/updates/2015/09/history-api-scroll-restoration

提交回复
热议问题