I am using browser IE8 to test my application and using the localStorage to track the application session. When I kill my browser from 'Task Manager' > 'kill IE process'. It does not clear my localStorage and when i open new browser then its says, you already have set the localStorage value.
here is the code which i am using.
How can I delete the localStorage, when user kills the browser from TaskManager?
Thanks Eric, I can not go with sessionstorage because IE8 has feature of 'New Session' and if i use the sessionstorage then i'll not be able to share the webstorage value across session. while with localstorage we have ability to share the webstorage value across the all the session of IE browser.
Joined: Nov 08, 2001
Killing the browser with the task manager or a browser being closed do to a run time error or computer going to sleep or whatever will not fire an unload event. There is no way to make the browser fire that event in a bunch of different scenarios.
Basically you are going to have to write some sort of hand shake between the server and the client to see if when a session starts on the server, it wipes out the session on the client.
The local storage mechanism spans multiple windows and persists beyond the current session. Means, the data in a local storage area never expire, until we deletes through program.
Like cookies, this data persists even after you navigate away from the web site, close your browser tab, exit your browser, or what have you. Unlike cookies, this data is never transmitted to the remote web server (unless you go out of your way to send it manually). Unlike all previous attempts at providing persistent local storage, it is implemented natively in web browsers, so it is available even when third-party browser plugins are not.