By hari, 3 August, 2023 var interval; var redirecturl = "/home"; $(document).on('mousemove keyup keypress',function(){ //clear it as soon as any event occurs. clearTimeout(interval); //do any process and then call the function again //call it again settimeout(); }) function settimeout(){ interval=setTimeout(function(){ window.localStorage.clear(); window.sessionStorage.clear(); window.location.replace(redirecturl); },600000) } Tags JavaScript jQuery