See if either of these helps out:
Both questions have multiple answers based on your needs and preferences.
It's not but the code still works and is all there. Should be easy enough to test yourself, but I can see if I still have it to reupload if you need me to.
Also, is there a way to do this locally on the player's machine?
The local storage route should work for that. The original method I posted there won't. The postmessage API answer should also work, though I haven't personally tested it.