运行浏览器关闭选项卡或浏览器出口上的方法 [英] Running a method on browser close tab or browser exit

查看:103
本文介绍了运行浏览器关闭选项卡或浏览器出口上的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有我可以在Javascript +角+ JQuery的使用操作处理程序,使得它可以安排要执行的方法之前选项卡中的web浏览器被关闭。

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.

通过接近我的意思是在quiting浏览器或关闭的选项卡或崩溃或什么...

By close i mean quiting the browser or closing the tab or crashing or anything...

推荐答案

是啊,你刚才绑定的 beforeunload 窗口对象。

Yeah, you just bind the the beforeunload on the window object.

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

这篇关于运行浏览器关闭选项卡或浏览器出口上的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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