Is there a command that executes after a period of inactivity?

I’ve been searching all over the net for a way to have a webpage go back to a set page after a period of inactivity. Something where if the mouse hasn’t moved for say, five minutes, then it automatically goes back to the main page. Is that even possible? Maybe I’m just looking in the wrong place. I’m not sure what exactly you would call it, or what to look for.

Any help would be greatly appreciated. Thank you.

Specter34