create custom popup if I want to disconnect (back to the login page) or not, when i click on the Back button of the browser.
Asked
Active
Viewed 144 times
-2
-
you can use this, but it is disappearing quickly: window.onbeforeunload = function (e) { e.preventDefault(); $(".modal_Popup").show(); } – user3296338 Apr 12 '20 at 14:14
1 Answers
-1
You can use this:
$(window).on('beforeunload', function(){
return 'Are you sure you want to disconnect?';
});

Armash Ansari
- 78
- 9
-
That will fire when the backbutton is clicked … and when the browser is closed, then a new URL is typed into the address bar, when any link is clicked, etc, etc. – Quentin Apr 12 '20 at 12:24
-
you can use this, but it is disappearing quickly window.onbeforeunload = function (e) { e.preventDefault(); $(".modal_Popup").show(); } – user3296338 Apr 12 '20 at 14:13