asp-classic - 在 Web 浏览器中捕获选项卡关闭事件?

标签 asp-classic

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

最佳答案

onbeforeunload 也会在以下事件中被调用 -

* Close the current browser window.
* Navigate to another location by entering a new address or selecting a Favorite.
* Click the Back, Forward, Refresh, or Home button.
* Click an anchor that refers the browser to another Web page.
* Invoke the anchor.click method.
* Invoke the document.write method.
* Invoke the document.open method.
* Invoke the document.close method.
* Invoke the window.close method.
* Invoke the window.open method, providing the possible value _self for the window name.
* Invoke the window.navigate or NavigateAndFind method.
* Invoke the location.replace method.
* Invoke the location.reload method.
* Specify a new value for the location.href property.
* Submit a form to the address specified in the ACTION attribute via the INPUT type=submit control, or invoke the form.submit method.

因此,如果您尝试在用户关闭选项卡或浏览器窗口时将其注销,则每次他们单击链接或提交页面时,您最终都会将其注销。

关于asp-classic - 在 Web 浏览器中捕获选项卡关闭事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/138411/

相关文章:

vbscript - 如何在 vbScript 中解析 ISO 8601 时间戳

class - 设置值后 VBScript 类属性为空

asp-classic - 经典 ASP 的奇怪 COM 问题

javascript - ckeditor加载完成后如何提交

sql - ADO 命令参数未传递到存储过程或存储过程 'Ignoring' 参数

url - 使用变量的经典 ASP 重定向 URL

php - 在使用 PHP Simple HTML DOM Parser 之前登录到 ASP 网站

javascript - 从经典 .ASP 重复区域调用正确的、单独的模态菜单

c# - Response.Redirect HTTP 状态码

regex - 如何在正则表达式中匹配[除X之外的任何字符]?