Command for clear LocalStorage from CLI


#1

Hi all,

Is there a way to force the clean of LocalStorage when debugging (when launching ionic run ).
Actually i launch my app on my device, and i would like to have a clean localStorage for my tests.
Maybe via an option in the CLI (idk if it’s possible technically) ?

Or there is another way ?


#2

Try this method:

window.localStorage.clear();


#3

Thanks for your reply.
This method woks only in the code, i would like to know if there is a way to do it when i run my app for testing/debugging via the CLI ?


#4

Can’t you use the chrome debugger?

If you just go to the chrome console and run localStorage.clear() it is done.


#5

Thx mathijsliquix, i didnt know that i could use chrome console for that. It could be a way to do it.