What I'm trying to do is to flush localStorage
when user move to other page.
For example, let say I'm currently in http://foo.com/accounts/mypage.
When user moves to url, http://foo.com/album, I want to flush localStorage
.
This is my JQuery
script.
$(window).unload(function(){
if ((window.location.pathname).indexOf('mypage') < 0) {
localStorage.flush();
}
});
But it doesn't work......
Any other nice idea?