浏览器关闭或刷新事件监听

  var confirmationMessage = "\o/";
  (e || window.event).returnValue = confirmationMessage; //Gecko + IE
  return confirmationMessage;                        //Webkit, Safari, Chrome
});```

[原问题地址](https://stackoverflow.com/questions/3888902/javascript-detect-browser-close-tab-close-browser)

你可能感兴趣的:(浏览器关闭或刷新事件监听)