-1

I have this simple piece of code.

$(window).bind('beforeunload', function () {

    var c = confirm();
    if (c) {
        return true;
    }
    else {
        return false;
    }

});

Its works great with Chrome browser in all systems except one. I don't understand why it's not working in that particular system.

This issue came with only one system (But its working fine in same system in Incognito mode).

System Configuration:
OS: Windows
Browser: Chrome (Latest Version).

Zach Jensz
  • 2,608
  • 3
  • 8
  • 23
Sumit
  • 1
  • 1
  • 1
    Not how beforeunload works in modern browsers. I am amazed that would work on other machines. Basically what you want to do is not possible. https://stackoverflow.com/questions/38879742/is-it-possible-to-display-a-custom-message-in-the-beforeunload-popup – epascarello May 18 '22 at 17:49
  • 1
    There are many issues with `beforeunload` : Have you [read this?](https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event) – fnostro May 18 '22 at 17:54

0 Answers0