Skip to content Skip to sidebar Skip to footer

Keep Changes On DOM When Pressing Back/forward Buttons

I have already seen similar questions like: Ajax, back button and DOM updates, and in fact, what I tried so far is inspired by the answers on those. However, none of them describe

Solution 1:

If you're really changing pages, the yes, even if working from cache the browser will show the page as it was when retrieved from the server, not as it was when modified afterward.

If you want to keep the Page A / Page B structure the way it currently is rather than swapping over to a more SPA approach, you could store the ajax result in sessionStorage and check for it on page load. If there, reapply it; if not, request via ajax and apply it (and save it). That will be much faster than re-requesting it across the network.


Post a Comment for "Keep Changes On DOM When Pressing Back/forward Buttons"