Save and restore the current state of the web page through js

1. After saving the web page to localstorage, and then closing the browser through the scheduled task, the next time you open the url, you will get the saved content from localstorage, and then you can continue with the operation. I use vue2
2. It won"t work if you try to write the following code

  let nowPage = $("html").html()
  $("html").html(this.hispage)

the elements of the page have returned to normal, but style has changed slightly (not much), but buttons can"t be clicked.
if you have a feasible plan, please let me know.

Apr.03,2021

you should just display the page elements, but the corresponding data for these elements, events are gone. Naturally, you can't click on it. You can save the vueData,vuex data together and try re-assigning values


it is feasible to save store and re-applyStore it next time.

but this requires your project to be completely "data-driven".

I don't think you want to "restore the page". Tell me about your original needs.

Menu