Recently i was working on sign out idle user after certain minutes. After so much tiresome tries i was able to generate a JavaScript that log out windows authenticated user in each browser.
Here is the code that you need to add in master page.
var IDLE_TIMEOUT = 30*60; //seconds - need to sign out if idle for 30 min.
var _idleSecondsCounter = 0;
document.onclick = function () {
_idleSecondsCounter = 0;
};
document.onmousemove = function () {
_idleSecondsCounter = 0;
};
document.onkeypress = function () {
_idleSecondsCounter = 0;
};
window.setInterval(CheckIdleTime, 1000);//milliseconds (1 sec = 1000 millisecond) check every 1 second for idle timeout
function CheckIdleTime() {
_idleSecondsCounter++;
if (_idleSecondsCounter >= IDLE_TIMEOUT) {
document.location.href = window.location.protocol + "//" + window.location.host + _spPageContextInfo.siteServerRelativeUrl + "/_layouts/15/closeConnection.aspx?loginasanotheruser=true?Source=";
}
}
Subscribe to:
Post Comments (Atom)
-
In last blog we learn how can we enable footer on SharePoint Online Modern Communication site. If you have not gone through that you can use...
-
One of our client wanted to show Employee Directory and our first suggestion was to build custom SPFx which will fetch data from Azure AD or...
-
Recently I was working on sending mail using smtp server where I stuck on below error: IIS/SMTP - emails are stuck in mailroot/Queue ...
No comments:
Post a Comment