Onunload function and onbeforeunload function do not work when the page is closed?

  node.js, question
window.onbeforeunload = function(){
 How to solve the problem if the browser does not execute alert?

Since 25 May 2011, the HTML5 specification states that calls to window.alert(), window.confirm(), and window.prompt() methods may be ignored during this event. See the HTML5 specification for more details.


You can directly in the function insidereturn "123"A prompt will be generated.