Skip to content
Advertisement

How to clear Local Storage from client whenever i publish new code

I have build my application on Angular 4 and I am using local storage to store user session. What I want is whenever I publish my application, user local Storage should get reset so that data before release should not create any problem.

How do i do that?

Advertisement

Answer

using versioning, keep an extra key at client side which will be having the last version. If version matches then it means no new code has been published, if version doesn’t match which tells that new code has been passed, then just have a utility which will clear the local-storage.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement