开发者

Is there a way to get a mobile Safari WebApp to "forget" its state?

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 achi开发者_开发技巧eved with javascript?

Thanks for any insight.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜