The Log Out of Salesforce Keyboard Shortcut

Available in: Salesforce Classic

This is part of Developing with the Service Cloud.

Note this code requires the creation of a custom keyboard shortcut that launches an event called "customShortcut.Logout". This can be done in the Salesforce Console configuration page under the keyboard shortcuts setting.

Please note that this is sample code. It must be enhanced and tested to production quality as required if you choose to utilize it.

The Apex Controller.

        var logoutEventHandler = function() {
            top.location = '/secur/logout.jsp';
        }
        sforce.console.addEventListener('customShortcut.Logout', logoutEventHandler);  

The code above must be added to a Visualforce page. A new custom Console component pointing to this VF page must then be created in setup. Finally this new component must be added to the Console footer bar via the Console configuration page.

In this instance, it's best if the custom Console component is hidden, as there is no need to display it to the user.