Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否有我可以在 Javascript+Angular+JQuery 中使用的操作处理程序,它可以安排在 Web 浏览器中关闭选项卡之前执行的方法?
关闭我的意思是退出浏览器或关闭选项卡或崩溃或任何事情......
是的,你只需绑定beforeunload window 对象上的 。
beforeunload
angular.element($window).bind("beforeunload", exitHandler)