If the content is loaded after firing at the "load" event, the "Back" button will not return you to the position you were in. Because the browser scrolls before the "load" event.
In order for the browser to remember the scroll position at this time, you need to save the scroll location and status (what content was downloaded) somewhere before navigation. Either in the cookie or in the URL hash.
If pageA is a static page with no dynamic content (loaded after the "load" event, the browser must remember the scroll position when you return.
For dynamic content, there are at least two parts. One of them restores the status of the page when it presses the "Back" button, so all dynamic content is loaded, some expanders expand or collapse. Another scroll there.
The first part depends on how the page is implemented. In the second part, you can put the top of the scroll in the cookie when the page does onUnload. for example
$(window).unload(function() {$.cookie('scrollTop',$(window).scrollTop());});
Sheng
source share