From 618999f3cc7207a0f04a3837872b6c84696d8136 Mon Sep 17 00:00:00 2001 From: KLuka Date: Thu, 5 Mar 2015 15:46:13 +0100 Subject: [PATCH] Issue #114: popup warning on tab/window close JS `window.onbeforeunload` handler was added, and it will be trigger if session is active. Reference: 6693512fde244cbb7f10e0033d4b4e5ec1b20e32 --- shellinabox/root_page.html | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/shellinabox/root_page.html b/shellinabox/root_page.html index 38bde27..41b6488 100644 --- a/shellinabox/root_page.html +++ b/shellinabox/root_page.html @@ -99,6 +99,16 @@ ''); } })(); + + // User warning on window close + window.onbeforeunload = function(e) { + if (typeof window.shellinabox.session != "undefined") { + return "Are you sure you want to leave this page?"; + } else { + return null; + } + } + --> @@ -107,7 +117,7 @@ correctly deal with the enclosing frameset (if any), if we do not do this --> -