简体   繁体   English

在浏览器关闭选项卡或浏览器出口上运行方法

[英]Running a method on browser close tab or browser exit

Is there an action handler I can use in Javascript+Angular+JQuery that makes it possible to schedule a method to be executed just before a tab is closed in the webbrowser. 是否有一个我可以在Javascript + Angular + JQuery中使用的动作处理程序,它可以安排在Web浏览器中关闭选项卡之前执行的方法。

By close i mean quiting the browser or closing the tab or crashing or anything... 关闭我的意思是退出浏览器或关闭标签或崩溃或任何东西......

是的,你只需在窗口对象上绑定beforeunload

angular.element($window).bind("beforeunload", exitHandler)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM