Q:

Keep script active between and during page change/refresh

I'm not an expert in JavaScript or JQuery and can't seem to figure this out:
Is it possible to keep a script active (for example a cryptominer that runs at 50% while you're browsing the website) between page changes or refreshes.
For the project I'm working on it's not possible to store this value somewhere and pick it back up later to start it again (and possibly correct for the time the load was taking). It actually has to run.
Or is the only way to keep the main page active with the script in it and refresh only (part of) the content?
If this last option is the only way, does anyone know if Google Adsense will pick up the new content as a new page or will it think of it as still the same page?
Any insight is appreciated.

A:

The only tool you have available (Without involving extensions, or anything the user needs to download), is service workers.
As @KevinB points out, you can also use localStorage or cookies in order to keep data between pages (But this will require at least one page being open in order to keep running).
Additionally, depending on how much coding is involved: You should consider a 1 page application design (Sorta like facebook). You really wouldn't be navigating to other pages, just reloading content in place on a single page. This would allow your scripts to continue to run in between pages (As the content would be delivered via ajax, instead of navigating away).

