当关闭浏览器或标签页时执行onbeforeunload方法,此方法适应于大多数浏览器。
<script type="text/javascript">
window.onbeforeunload = function() {
//Do Sth...
return 'MSG';//返回值 Number/Boolean/Object/String
};
</script>
详细说明参考:http://w3help.org/zh-cn/causes/BX2047
当关闭浏览器或标签页时执行onbeforeunload方法,此方法适应于大多数浏览器。
<script type="text/javascript">
window.onbeforeunload = function() {
//Do Sth...
return 'MSG';//返回值 Number/Boolean/Object/String
};
</script>
详细说明参考:http://w3help.org/zh-cn/causes/BX2047
转载于:https://my.oschina.net/tsai/blog/79368