Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript code to test if screen is idle

var inactivityTime = function () {
    var time;
    window.onload = resetTimer;
    // DOM Events
    document.onmousemove = resetTimer;
    document.onkeydown = resetTimer;

    function logout() {
        alert("You are now logged out.")
        //location.href = 'logout.html'
    }

    function resetTimer() {
        clearTimeout(time);
        time = setTimeout(logout, 3000)
        // 1000 milliseconds = 1 second
    }
};
Comment

PREVIOUS NEXT
Code Example
Javascript :: vue js debounce input 
Javascript :: js set visibility 
Javascript :: js string to charcode array 
Javascript :: vscode new file shortcut 
Javascript :: reactjs wait for image to load from url 
Javascript :: how to use react memo hooks 
Javascript :: same file select angular second time not selected 
Javascript :: e.target.id not working react js 
Javascript :: opposite number js 
Javascript :: coderbyte find intersection solutions 
Javascript :: using filter and pipe in rxjs 
Javascript :: javascript filter array of objects 
Javascript :: javascript switch syntax 
Javascript :: react qurery jest test mock queryClientProvider 
Javascript :: EXPRESS APP REGISTER HANDLEBARS VIEW ENGINE 
Javascript :: json schema e.g. 
Javascript :: loop through async javascript -1 
Javascript :: Angular Quick Tip: Binding Specific Keys to the Keyup and Keydown Events 
Javascript :: Create A React State 
Javascript :: js deep copy 
Javascript :: new features of angular 11 
Javascript :: console.log full object 
Javascript :: javascript Use clearTimeout() Method 
Javascript :: javascript loading animation 
Javascript :: star looping javascript 
Javascript :: this keyword in javascript 
Javascript :: javascript event listener get id of clicked items 
Javascript :: split 
Javascript :: suitescript get sublist value 
Javascript :: array from js 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =