3

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 web browser?

By close I mean quitting the browser or closing the tab or crashing or anything...

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
David Karlsson
  • 9,396
  • 9
  • 58
  • 103

1 Answers1

4

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

angular.element($window).bind("beforeunload", exitHandler)
Kevin Stone
  • 8,831
  • 41
  • 29