How can I handle browser tab close event in Angular? Only close, not refresh.

3,812 views
Skip to first unread message

Raghu Ram

unread,
Aug 21, 2019, 6:27:48 AM8/21/19
to Angular and AngularJS discussion

How can I handle browser tab close event in Angular? Only close, not refresh.

I am not able to identify when page is refreshed and when tab or browser is closed.

Because in both cases it fires "window:unload" and window:beforeunload" event so it's hard to identify.

Message has been deleted

Sander Elias

unread,
Aug 21, 2019, 6:37:23 AM8/21/19
to Angular and AngularJS discussion
Hi Raghu,

May I ask why you want to know?
You can check some tings on returning to the page, but I'm afraid the browsers security modal doesn't allow to make the separation you are asking for.

Regards
Sander

Raghu Ram

unread,
Aug 21, 2019, 7:24:04 AM8/21/19
to Angular and AngularJS discussion
Hi Sander,

I want to clear some local storage values on close of browser tab, so is there any solution in Angular 5. 

Regards
Raghu Ram

Ray Max

unread,
Jun 29, 2020, 11:56:05 AM6/29/20
to Angular and AngularJS discussion

Ray Max

unread,
Jun 29, 2020, 11:56:06 AM6/29/20
to Angular and AngularJS discussion
Hello,

I need to end session and get page where the user is been dropout by making a ajax call


On Wednesday, August 21, 2019 at 4:07:23 PM UTC+5:30, Sander Elias wrote:
Reply all
Reply to author
Forward
0 new messages