在网络浏览器中捕捉标签关闭事件? [英] Catching a tab close event in web browser?

查看:23
本文介绍了在网络浏览器中捕捉标签关闭事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法知道用户是否关闭了网络浏览器中的标签?特别是 IE7,还有 FireFox 等.如果包含我们网站的当前选项卡关闭,我希望能够通过我们的 asp 代码处理这种情况.

Is there any way of knowing if the user closes a tab in a web browser? Specifically IE7, but also FireFox and others as well. I would like to be able to handle this situation from our asp code if the current tab containing our web site closes.

推荐答案

附加一个onbeforeunload" 事件.它可以在浏览器/选项卡关闭之前执行代码.

Attach an "onbeforeunload" event. It can execute code just before the browser/tab closes.

这篇关于在网络浏览器中捕捉标签关闭事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆