How many ways can we save some data on the browser(client) end and retrieve it back even after a refresh:

  1. We can use localstorage or sessionstorage
  2. Use cookies
  3. Rewrite URL(although not elegant, but still can get the job done)
  4. 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 = + “somedata”;

Hit enter and refresh the page, now if you try to access on the console, you can still retrieve the saved data.

Using this cool trick angular folks have implemented the reloadWithDebugInfo functionality.

“Keep Learning.”