Jump to content

NikolaNikic

Member
  • Posts

    30
  • Joined

  • Last visited

Community Answers

  1. NikolaNikic's post in Inactive / Idle user: site redirect to homepage was marked as the answer   
    Hi @THDesign

    Check if this code works for you: 
    Add to: Website tools > Code injection 
    <script> (function() {     const idleDurationSecs = 20;    // X number of seconds     const redirectUrl = '';  // ADD URL IN WICH YOU WANNA REDIRECT USERS es. yourpage.com/home     let idleTimeout; // variable to hold the timeout, do not modify     const resetIdleTimeout = function() {         // Clears the existing timeout         if(idleTimeout) clearTimeout(idleTimeout);         // Set a new idle timeout to load the redirectUrl after idleDurationSecs         idleTimeout = setTimeout(() => location.href = redirectUrl, idleDurationSecs * 1000);     };     // Init on page load     resetIdleTimeout();     // Reset the idle timeout on any of the events listed below     ['click', 'touchstart', 'mousemove'].forEach(evt =>          document.addEventListener(evt, resetIdleTimeout, false)     ); })(); </script>  
    Hope this works 
    IF this works click the mark as solution button 
×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.