As Green Screens 5250 Terminal is web based and runs in browser tabs, it is highly likely that user might to accidentally close browser window and thus terminal session also.
There are few approaches to prevent this...
- single user script through TamperMonkey browser extension
- through Web Admin console global script
- through latest Green Screens browser extension
If you have Green Screens Terminal version older than 3.8.0, the first two options are the only options. Below is a simple script that will activate browser close detection and show a popup window asking for confirmation.
If you want to set this feature for all users, simply add script in web admin console customization box.
NOTE: Don't forget to wrap code inside script tag!
// ==UserScript==
// @name WebTerminalScripts
// @namespace http://www.greenscreens.io
// @description Sample Hello world script
// @copyright 2017. Green Screens Ltd.
// @version 1.0
// @license BSD
// @author Green Screens Ltd.
// @homepage http://www.greenscreens.io
// @icon http://www.greenscreens.io/assets/images/logo.png
// @updateURL
// @run-at document-end
// @match http*://*/lite*
// @grant none
// @noframes
// ==/UserScript==
(function() {
'use strict';
window.onbeforeunload = function(event) {
if (Tn5250 && Tn5250.Browser) {
return "Your work will be lost.";
}
};
})();