js判断是刷新还是关闭浏览器,js判断刷新页面,js判断关闭页面

window.onbeforeunload = onbeforeunload_handler;

window.onunload = onunload_handler;

 

function onbeforeunload_handler(){

  var warning="确认退出?"; return warning;

}

function onunload_handler(){

  var warning="谢谢光临"; alert(warning);

}

posted @ 2017-05-03 15:50  jok311  阅读(860)  评论(0编辑  收藏  举报