我有下面的javascript
<script type="text/javascript">
window.onbeforeunload = function (beforeclose) {
var message = 'Are you sure that you want to close the greenhouse!!!';
if (typeof beforeclose == 'undefined') {
beforeclose = window.event;
}
if (beforeclose) {
beforeclose.returnValue = message;
}
return message;
}
</script>此方法是在关闭之前向用户发出的警报。我想要的是在关闭窗口后使用一个方法。比如:“当下面的页面关闭时,做点什么”。有没有像onafterunload这样的东西?
发布于 2014-03-27 19:51:45
不,在卸载之后,当浏览器或标签被关闭时,你不能运行。是的,您可以处理服务器端的会话输出事件。
发布于 2014-03-27 19:55:48
不,没有这样的事件,但您可以使用:
$(window).unload(function() {
//do something
}https://stackoverflow.com/questions/22686700
复制相似问题