Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
JavaScript
 onload = function () {
        var t;
        window.onload = resetTimer;
        document.onmousemove = resetTimer;
        document.onkeypress = resetTimer;
        document.onclick = resetTimer;
        function logout() {
            Ext.Msg.show({
                title: 'Please sign in again',
                msg: 'Auto logout due to inactivity.',
                buttons: Ext.MessageBox.OK,
                width: 300,
                closable: false,
                fn: function (buttonId, text) {
                    if (buttonId == 'ok')
                        location.href = "<?php echo $this->createAbsoluteUrl('app/logout'); ?>";
                }
            });
        }
        function resetTimer() {
            clearTimeout(t);
            t = setTimeout(logout, 900000)//for 15 minutes
            // 1000 milisec = 1 sec
        }
    }
    if (typeof console == "undefined" || typeof console.log == "undefined")
        var console = {log: function () {
            }};
</script>


What I have tried:

JavaScript
 onload = function () {
        var t;
        window.top.onload = resetTimer;

window.top.onmousemove=resetTimerl



        window.top.onmousemove = resetTimer;
        window.top.onkeypress = resetTimer;
        window.top.onclick = resetTimer;
        function logout() {
            Ext.Msg.show({
                title: 'Please sign in again',
                msg: 'Auto logout due to inactivity.',
                buttons: Ext.MessageBox.OK,
                width: 300,
                closable: false,
                fn: function (buttonId, text) {
                    if (buttonId == 'ok')
                        location.href = "<?php echo $this->createAbsoluteUrl('app/logout'); ?>";
                }
            });
        }
        function resetTimer() {
            clearTimeout(t);
            t = setTimeout(logout, 900000)//for 15 minutes
            // 1000 milisec = 1 sec
        }
    }
    if (typeof console == "undefined" || typeof console.log == "undefined")
        var console = {log: function () {
            }};
</script>
Posted
Updated 11-Apr-16 0:36am

1 solution

JavaScript
onload = function () {
        var t;
        window.top.onload = resetTimer;
 
window.top.onmousemove=resetTimer;
 

 
        window.top.onmousemove = resetTimer;
        window.top.onkeypress = resetTimer;
        window.top.onclick = resetTimer;
        function logout() {
            Ext.Msg.show({
                title: 'Please sign in again',
                msg: 'Auto logout due to inactivity.',
                buttons: Ext.MessageBox.OK,
                width: 300,
                closable: false,
                fn: function (buttonId, text) {
                    if (buttonId == 'ok')
                        location.href = "<?php echo $this->createAbsoluteUrl('app/logout'); ?>";
                }
            });
        }
        function resetTimer() {
            clearTimeout(t);
            t = setTimeout(logout, 900000)//for 15 minutes
            // 1000 milisec = 1 sec
        }
    }
    if (typeof console == "undefined" || typeof console.log == "undefined")
        var console = {log: function () {
            }};
</script>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900