phreakocious commented on a change in pull request #592:
URL: https://github.com/apache/guacamole-client/pull/592#discussion_r585933908
##########
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:
This event has special properties and causing the browser to generate a
prompt is exactly what it does. It used to be possible to provide a custom
message via the returnValue, but that has been deprecated in pretty much all
browsers for security reasons.
----------------------------------------------------------------
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]