Streaming live at 10am (PST)

Javascript Time Out Except Two Pages

I am not good with Javascript but we have a script running on our site that after 360 sec idle the page redirects to /. However, I want to add to the script to not redirect if idle at all for two different pages. Can anyone help me add to this script so that it does not redirect if idle on specific pages?

Here is my site Read-Only: LINK
(how to share your site Read-Only link)

You could make the code a callable Javascript function (like on my picture) and then call it on the pages you want the function to run :slight_smile:


Thank you! If I did that there are +100 pages to call the function. Is there a way to do an exception instead?

Ah, yes that’s true.

Im sure someone has a much smarter solution than me, but you could add something that checks if a variable exists.


So wrap your global code inside the “if statement” and on the pages where you don’t want the redirect to happen you set this variable to true, in this case the “notAllowedToRedirect” variable.

This variables has to be set inside the head (and not before the </body) so the variable is set before the function call in the global custom code.