Questions tagged [browser-close]
27 questions
19
votes
4 answers
Prompt User before browser close?
We have an administrative portal that our teachers constantly forget to download their latest PDF instructions before logging out and/or closing the browser window. I have looked around but can't find what I'm looking for.
I want to accomplish the…

JM4
- 6,740
- 18
- 77
- 125
4
votes
6 answers
Browser refresh using OnBeforeUnload event
On the web page when the user clicks on the logout button, I have a JavaScript function which clears the user session which is stored on the MongoDB. It works fine.
Also I would like to clear the user session when the user closes the browser. Here…

Jackal
- 2,591
- 3
- 25
- 29
3
votes
0 answers
how to execute a function only when reload is clicked not cancel on beforeunload event in angular 2+?
I implemented to save the changes on on refresh/close event as :
@HostListener('window:beforeunload', ['$event'])
beforeunloadHandler(event) {
//save the form to local storage
event.returnValue = false;
}
It is working fine but the…

Shruti
- 75
- 10
3
votes
1 answer
Sending ajax when user closes browser window
My Main GOAL and actual scenario: If two users share the same credentials, then the second user can not login into the system until the first one who is already logged in, log outs system.
Actually I want to set login_flag=0 on server database, when…

Rajan Rawal
- 6,171
- 6
- 40
- 62
2
votes
0 answers
React with typescript close tab/windows
I need a custom dialog box to appear when the user closes the browsers tab or window.
I tried to write a component that wraps my app.
This is how i tried:
import * as PropTypes from 'prop-types';
import * as React from 'react';
import…

Wasyster
- 2,279
- 4
- 26
- 58
2
votes
1 answer
Detect/Prevent Browser Close or Session Storage Unload in Javascript/AngularJS
How can I use javascript or AngularJS to detect the browser or tab closing and allow the user to prevent it through a dialog message?
I have an AngularJS app that saves data to session storage so that the user can refresh the page without losing…

Stephen Marsh
- 95
- 1
- 1
- 7
1
vote
0 answers
call Logout api on browser close in blazor webassembly
how to call logout api on browser close by user. I have applied Ajax call to archive this but it works perfectly fine in local host but not work in "Linux Server" can anyone help me to find the solution.

Kishan Jamariya
- 89
- 3
1
vote
2 answers
Angular 6: Trying to make synchronous call (delete) on browser close event (beforeunload/unload event of browser)
Actually, I want to update a flag in Db using a service call(Delete method) once the user close the browser. I am able to detect browser close action using onbeforeunload and onunload events but async call doesn't work for me(sometimes in debugging…

Vivek Joshi
- 31
- 3
1
vote
1 answer
How to show alert while closing the react application in browser tab
I have tried the below code to show alert while we are closing the react application from browser tab, but it not happening, it is closing without alert.
I have also tried other helpful posts but nothing worked for me.
Any help would be helpful and…

Alok Ranjan
- 967
- 10
- 10
1
vote
1 answer
Does the localStorage get cleared when working with npm live-server?
I am currently working on a basic JS application that requires the usage of DOM storage or localStorage. In order to auto-save my changes, I incorporated the npm live-server.
After I shut down the live-server, I notice that the localStorage gets…

Abishek H
- 210
- 1
- 10
1
vote
2 answers
Django fire signal user_logged_out on browser close
I'm working on a django application with a chat for users. Therefore I need to present the status logged in or logged out to the other users. To accomplish this I used the signals environment of django. As long as the users are using the log out…

nando
- 41
- 7
1
vote
2 answers
Confirm Browser Exit/ On Browser Exit Techniques
I've been looking around for a while and haven't quite found what I've been looking for.
My web page stores reports, and the user has the ability to save these reports.
I'm looking for a method, using jquery or the javascript onunload/onbeforeunload…

Bob
- 3,074
- 11
- 43
- 62
0
votes
0 answers
Regarding Vimeo API browser close detection
Here, I am using the Vimeo API, to upload the video to the Vimeo
Here is the below HTML Code that sends the videos to the Node JS Server in local.
Here, video upload happens normally when the Stop Recording button is pressed, but when onbeforeunload…
0
votes
0 answers
Log a user out when they close the browser React JS Cognito
I am using ReactJS as my front end, with a python flask API backend. I have one hole in my application as it stands - when my users close out of the browser, they are not logged out (unless the Cognito refresh token expires).
However, I have read…

Christina Stebbins
- 380
- 3
- 14
0
votes
0 answers
Difference in Browser and tab close event for beforeunload
I'm working with Reactjs and have this requirement where I need to differentiate between Browser close event and Tab close event.
I'm using 'beforeunload' for this, but the event is called for both the events (browser and tab close).
My code looks…

Deepesh gulati
- 21
- 2