DEV Community

Discussion on: Please Stop Using Local Storage

Collapse
 
itachiuchiha profile image
Itachi Uchiha

I almost used localStorage my every project. For example:

let OrderID = document.querySelector(".orderNum").innerText;
window.localStorage.setItem("OrderID", OrderID);

After that, I redirect another page without any query string. I still need to OrderID. This is the best solution at the moment.

I did not store any important information in localStorage. Yes, I know we shouldn't store any password or related information in localStorage.

What about OrderID like information? Should I use? I don't want to use server-side sessions.

For example, I completed Order. I delete key from localStorage.

window.localStorage.removeItem("OrderID");

Thanks for this great article.

Collapse
 
rdegges profile image
Randall Degges

That seems fine to me!

Collapse
 
sebvercammen profile image
Sébastien Vercammen • Edited

After that, I redirect another page without any query string. I still need to OrderID. What about OrderID like information? Should I use? I don't want to use server-side sessions.

You've just discovered POST.