What I did was use unix time and web storage, when you exit the game it saves the last unix timestamp so that when you launch the game again it can calculate it with the current unix time to figure out how much time has passed while the game was closed.
Sorry I'm not very good at explaining in detail but that's the gist of it, hope it helps!