Is the onbeforeunload event running now?

  • 0
    When you close the browser, you need to display an alert in which the text stating that there is unsaved data on the page ...

    Tried using onbeforeunload event but nothing works. Tell me, have you removed support for this event in modern browsers? If not, is there a working example? Because the examples that I found on the Internet do not work.
    JavaScript Anonymous, Dec 3, 2020

  • 2 Answers
  • 0

  • 0
    window.onbeforeunload=function(){
    return "что угодно, браузер скорее всего напишет свое сообщение";
    }
    Sofia Mullins

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!