📜  卸载前的 js - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:12.488000             🧑  作者: Mango

代码示例1
window.addEventListener('beforeunload', (event) => {
  // Cancel the event as stated by the standard.
  event.preventDefault();
  // Chrome requires returnValue to be set.
  event.returnValue = '';
});