Prevent Refresh 'Jump' with Javascript

后端 未结 5 820
滥情空心
滥情空心 2021-02-05 17:20

I\'ve noticed that if you are on a page and you have scrolled down a good bit, if you refresh the page, most browsers will jump you back down to your position. Is there any way

5条回答
  •  南方客
    南方客 (楼主)
    2021-02-05 18:01

    Something like below works for me, create some item that can be focused and focus it to scroll page.

    In this case it will scroll back to top after refresh the page.

    Tested on latest IE/FF/Chrome.

        
        
            
        
        
            
            
    
            
    top
    content

    Regards,

    Ben

提交回复
热议问题