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.
