This page is a Python machine. Close the tab and it hibernates as a few MB; reopen and it wakes exactly where it was, variables and files intact. Export the whole running computer as a signed .pymachine file and open it only when its public key is trusted.
Try it: run this, then close the tab and come back. The counter and the file keep counting.