Friday 17 July 2015

sharepoint logout of page after every 20 mins using script

var idle = 0;
$(document).ready(function () {
    //Call timeOutCheck every 10 minutes.
    var idleInterval = setInterval(timeOutCheck, 600000); // 10 minute

    //set idlaTimer to true on mouse click/keypress/keydown
    $(this).mousedown(function (e) {
        idle = 1;
    });
    $(this).keypress(function (e) {
        idle = 1;
    });          
    $(this).keydown(function (e) {
        idle = 1;
    });
});

function timeOutCheck() {

   
    if (idle == 0) { // 20 minutes
        window.location.assign(_spPageContextInfo.webAbsoluteUrl+"/_layouts/15/signout.aspx")
        //alert("time out");
    }
    else
    {
        //reset the timer
        idle = 0;
    }
}


No comments:

Post a Comment