Hi,
The behaviour you describe is “by design” – out-of-bounds events raised just before calling Application.Exit() aren’t executed.
Clearing the local storage is an out-of-bounds event, meaning it’s executed asynchronously, after other actions are done. In this case, other actions means Application.Exit(). So by the time Wisej is supposed to clear the local storage, there is no session any longer, so there is nothing for Wisej to do.
Since clearing the local storage is an out-of-bounds event, we can use Application.Update() on a Page or Form. Plesae give this a try
Application.Update(this, () => { Application.Browser.LocalStorage.Clear(); }); Application.Exit();
Another approach is to execute code in the browser when Application.Exit() is called on the server. Please refer to this thread.
Nevertheless, using session storage is the best approach for temporary storage of information you don’t want to be persistent after the browser/tab is closed.
Some workaround to this?
Application.Update(this, () => {
Application.Browser.LocalStorage.Clear();
});
Application.Exit();
it worked fine with the wisej 1x, but doesnt work as expected with the wisej 2x
Thanks in advance
I want to use localstorage because i want to it to be persistent.
I have a hybrid android app (webview) that points to my url, when I close and reopen the app or restart the phone, I restore the state through localstorage.
I will try your advice, i had to use a timer to have a Application.Exit() after localstorage clear
Thanks
Hi,
Thank you for your report. We are investigating the issue.
In the mean time, since you want to clear the browser storage when a session ends, maybe you should try SessionStorage. Session storage is per tab and it goes away when you close the tab and, of course, when you close the browser. This behaviour of SessionStorage is defined by the W3C Recommendation and is the browser’s responsibility
Please login first to submit.