>
> What I need is to delete ... data ... when user closes the tab or browser.
> But those ... data should not be deleted on page reload.


For this purpose, You should use *Window.sessionStorage* to store data.
https://developer.mozilla.org/ja/docs/Web/API/Window/sessionStorage

How can I do that? Which properties of event should I look for?

I should cover the following:
> - Browser close
> - ...


I don't recommend to do that. Because these events are different behavior
depending on browsers and OS.


2016-01-01 22:25 GMT+09:00 <[email protected]>:

> Thanks for idea.
>
> How can I do that? Which properties of event should I look for?
>
> I should cover the following:
> - Browser close
> - Tab close
> - f5
> - ctrl+f5
> - refresh button click
> - ctrl+w
>
>
> On Thursday, December 31, 2015 at 9:44:03 PM UTC+1, Robert Ferentz wrote:
>>
>> No direct way to do it. Javascript doesn't differentiate between types of
>> leaving the page, like reload, link, submit, closing tab etc.
>>
>> You have one event called "beforeunload" on the window object which is
>> called on any of the above actions. You CAN however, inside that event,
>> check if the mouse was outside the viewport when the window was closed, or
>> if certain combinations of keys were pressed that are known to close a tab
>> or window.
>>
>> On Thursday, December 31, 2015 at 9:46:59 PM UTC+2, [email protected]
>> wrote:
>>>
>>> Hello,
>>>
>>> All the best in New Year!!!
>>>
>>> What is best practice to cleanup AngularJS app.
>>>
>>> What I need is to delete specific cookies, and specific data from local
>>> storage when user closes the tab or browser. But those cookies and local
>>> storage data should not be deleted on page reload.
>>>
>>> Regards,
>>> Z
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to