necouchman commented on a change in pull request #592:
URL: https://github.com/apache/guacamole-client/pull/592#discussion_r585936849



##########
File path: guacamole/src/main/webapp/app/client/controllers/clientController.js
##########
@@ -219,6 +220,26 @@ angular.module('client').controller('clientController', 
['$scope', '$routeParams
         remaining: 15
     };
 
+    /**
+     * Catch window or tab closing (ctrl-w) and prompt the user if there is an 
active connection
+     *
+     * @param {Event} e
+     * @returns {undefined}
+     */
+    var windowCloseListener = function onBeforeUnload(e) {
+        var managedClient = $scope.client;
+        if (managedClient) {
+
+            // Get current connection state
+            var connectionState = managedClient.clientState.connectionState;
+
+            // If connected, prompt to close
+            if (connectionState === 
ManagedClientState.ConnectionState.CONNECTED)
+                e.preventDefault();
+                e.returnValue = '';

Review comment:
       Got it, thanks for clarifying!




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to