Run script background

Hello. I would like to run a script with a setTimeOut in the background so that its execution does not end when the pages are changed. It’s possible?