1: Simply embed the javascript “redirectTimer.js” in all your web pages ( html / rpgle / aspx) :
<html>
<head>
<script type="text/javascript" src="redirectTimer.js"></script>
</head>
<body>
<p>This is your "main application" - You will stay on this page as long as you are active</p>
<button>Do stuff</button>
</body>
</html>
2: Modify the “redirectTimer.js” to use your timeout values and “logon” html/aspx/rpgle
/*
* When you include this script on any page - it will redirect you to your page
* place where "logon.html" is placed
*
* Regards - Niels Liisberg
*/
var restartRedirectTimer = (function () {
var timer;
var doit = function () {
window.clearTimeout(timer);
console.log("Timer reset");
var millisecBeforeRedirect = 10000; // <<< change this to your timeout value
timer = window.setTimeout(function(){
window.location.href = "logon.html"; // <<< change this to your location
},millisecBeforeRedirect);
};
doit();
return doit;
})();
// Set the timer for click and keys
window.onclick = window.onkeypress = restartRedirectTimer;
You can test it by open the logon.html in your browser:
1: Click on the logon button
2: You will now set the “main application”
3: Keep clicking and typing
4: When you stop – you will be redirected to logon.html after 10 sec.
However on further testing we are still getting an issue.
Call program with automatic log-on. End program
Call program with manual log on. Log on then end program
Call program with automatic log-on. Initial display OK but logon box displayed when further key pressed.
This does not happen every time, just most times.
Works in Chrome but not in IE9.
Also. How would I get this code into the Icecap app. ?
Re: Auto signoff
Hi;
The best way is to let the client ( the browser ) application take hand of that:
You can download the following and place in your IceBreak development server root on the IFS to see how it can be achieved:
http://demo.icebreak.org/webfiles/samples/autosignoff.zip
1: Simply embed the javascript “redirectTimer.js” in all your web pages ( html / rpgle / aspx) :
2: Modify the “redirectTimer.js” to use your timeout values and “logon” html/aspx/rpgle
You can test it by open the logon.html in your browser:
1: Click on the logon button
2: You will now set the “main application”
3: Keep clicking and typing
4: When you stop – you will be redirected to logon.html after 10 sec.
Have fun :)
Best regards,
Niels Liisberg
Re: Auto signoff
Thank you for your help this morning.
However on further testing we are still getting an issue.
Call program with automatic log-on. End program
Call program with manual log on. Log on then end program
Call program with automatic log-on. Initial display OK but logon box displayed when further key pressed.
This does not happen every time, just most times.
Works in Chrome but not in IE9.
Also. How would I get this code into the Icecap app. ?
Thanks.
Don't work in IE
My bad ... IE don't support console.log()
Simply remove this line and you are golden..
Niels