Javascript to auto sign out on Sharepoint

Beside you can do the auto sign out a user on the central admin. You can also do it with custom code with javascript and apply it on the master page then set interval of time page will redirect to singout.aspx page.

$(document).ready(function () {
    idleTime = 0;
    LogOutInactive();
});

function LogOutInactive() {
    var idleInterval = setInterval(timerIncrement, 60000);
    $(this).mousemove(function (e) {
    idleTime = 0;
});

$(this).keypress(function (e) {
        idleTime = 0;
    });
}

function timerIncrement() {
    idleTime = idleTime + 1;
    if (idleTime > 9) {
        window.location = "http://[your site]/_layouts/15/SignOut.aspx";
    }
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.