-2

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.

user3296338
  • 57
  • 1
  • 2
  • 10
  • 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 Answers1

-1

You can use this:

$(window).on('beforeunload', function(){
      return 'Are you sure you want to disconnect?';
});
  • 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