From 1d278617ab9a1831e9d8f67b1be2194be448aade Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 21 Feb 2014 13:19:41 +0000 Subject: [PATCH] Whatever your browser prefers, we want to unload Icinga if you leave --- public/js/icinga/events.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/js/icinga/events.js b/public/js/icinga/events.js index cef015dad..0d62188b1 100644 --- a/public/js/icinga/events.js +++ b/public/js/icinga/events.js @@ -56,7 +56,9 @@ // We catch resize events $(window).on('resize', { self: this }, this.onWindowResize); + // Destroy Icinga, clean up and interrupt pending requests on unload $( window ).on('unload', { self: this }, this.onUnload); + $( window ).on('beforeunload', { self: this }, this.onUnload); // We catch scroll events in our containers $('.container').on('scroll', icinga.events.onContainerScroll); @@ -246,6 +248,7 @@ $(window).off('popstate', this.historyChanged); $(window).off('resize', this.onWindowResize); $(window).off('unload', this.onUnload); + $(window).off('beforeunload', this.onUnload); $(document).off('scroll', '.container', this.onContainerScroll); $(document).off('click', 'a', this.linkClicked); $(document).off('click', 'tr[href]', this.linkClicked);