How many ways can we save some data on the browser(client) end and retrieve it back even after a refresh:
- We can use localstorage or sessionstorage
- Rewrite URL(although not elegant, but still can get the job done)
- Appending/Prepending to the name attribute on the window object
You can try opening up any webpage and do a F12 to open up the console, then
window.name = window.name + “somedata”;
Hit enter and refresh the page, now if you try to access window.name on the console, you can still retrieve the saved data.
Using this cool trick angular folks have implemented the reloadWithDebugInfo functionality.