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)
What is the Use of X and Y Properties in Power Apps SharePoint List Form?
If you've spent any time customizing SharePoint List Forms using Power Apps, you've likely come across the X and Y properties ...
-
Code Review :- General 1. Remove the commented code 2. Variable name should not be contain "_". 3. Query should be in separat...
-
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...
-
Issue : Recently, we had a requirement to sync the calendar between shared mailbox outlook and SharePoint Calendar list. We have created 2 f...
No comments:
Post a Comment