jquery.idle icon indicating copy to clipboard operation
jquery.idle copied to clipboard

onIdle function sometimes executes well before idle timeout

Open nickpendleton opened this issue 4 years ago • 0 comments

I've implemented timed out logouts using jquery.idle. I have my idle timeout set to 20 minutes, but for some reason it occasionally triggers after 2 or 3 minutes. Really just curious if anyone has seen this behavior before?

I'm pulling the idle property from a div on the page, perhaps that's causing the issue? Here's my code:

$(document).idle({
    onIdle: function () {
        var baseUrl = $("#serviceUrl").attr("data-backend");
        var redirectUri = `/auth/timedout`;
        var encodedRedirectUri = encodeURIComponent(redirectUri);
        var url = `${baseUrl}/signout?redirectUri=${encodedRedirectUri}`
        window.location.href = url;
    },
    idle: $("#serviceUrl").attr("idle-timeout")
});

I've seen this happen both on Chrome 87 and Firefox 83, but only sporadically.

nickpendleton avatar Dec 15 '20 18:12 nickpendleton