js 检测页面刷新或关闭

window.onbeforeunload=function(){

//要提交的内容

return "随意写";//必须有return ,不然只有ie有效,chrome无效

}

原文地址:https://www.cnblogs.com/heifengwll/p/4555025.html