Persisting User Data in Browser

Monkey Forums/Monkey Programming/Persisting User Data in Browser

c.k.(Posted 2012) [#1]
I've searched all over the forums and found a lot of talk on persisting data in the browser. It seems it can't be reliably done.

I'd like my HTML games to have auto-login, which means storing a username/pw combo locally to the browser. However, it seems that if the user exits the browser and comes back later, the data might not be available anymore!

Anybody have present truth on this?


muddy_shoes(Posted 2012) [#2]
What makes you think this doesn't work? If you're testing using the MServer then the connection address changes every time you restart it. Changing the address means that the browser no longer associates the page with the stored data. This isn't true (mostly) for "real" websites.


c.k.(Posted 2012) [#3]
So, if I use Apache locally, my SaveString data will persist between runs (meaning, browser reruns, page reloads, new tabs, etc...)?

I'll test this when I get home tonight.

What do you think would happen if I restarted Apache? Would I lose the data?


muddy_shoes(Posted 2012) [#4]
As long as the URL is constant and you don't flush the browser's local data.


c.k.(Posted 2012) [#5]
Using Apache, it persists just fine. I can close the browser and come back, load up "localhost/mg/," and the saved string is there.

Doesn't work across browsers, but that's expected... With if my player wants to play from Chrome at home and IE at work! Uh oh. Will need login credentials for that, I guess. :-/

Thanks, muddy_shoes, for the input. The output is not garbage.