views:

113

answers:

1

I have a nascent bridge scoring app that is meant to be stored locally on an iPod touch/iPhone (iPad? Would probably be fugly...)

So far so good, got a custom icon rolling and basic JS navigation laid out, but my problem is that it retains its state when I quit the app. Is there a simple magic Apple meta tag for this? Or is it achieved with javascript?

Thanks for any insight.

+1  A: 

When you say

meant to be stored locally

Do you mean you are currently just testing via mobile safari? If so then naturally the state will be remembered. Closing safari on the iphone is comparable to minimizing your browser on a desktop. Provided there is memory free the process is held in the background.

Were you to package it up into a standalone process via phonegap or alike then you wouldn't see this behavior anymore as the memory is flushed automatically upon quit.

If you want to leave it as a web based app then having it hold it's state unless refreshed would be the expected behavior.

Adding the app to your home-screen also flushes the memory as far as I remember.

The only way I know to refresh the sate in the native safari would be via window.location.reload(). The problem with this is there is no way to know when to call this. You could listen for window focus but that would fire if you switched between tabs for example - which could be very frustrating.

Alex
My use case is "click the + button", "add to home screen", and use in a similar way to a native app (access from the home screen, it operates in "full screen" mode without the address bar, etc). It doesn't flush though, it acts as you say, as a minimized browser.
Alex Mcp