Session Expires when run as web app
I have an iOS web site that can also be run as a web app. Everything works fine running from Safari. However, wh开发者_运维问答en the site is being run as a web app, the session appears to expire whenever the user switch to another app. In my app, the user can lookup an address and pull up that address on the map. When the user return to the web app by double clicking the home button, they always get send back to the login page. I think it's because the session is gone so they have to login again. Is there a way to prevent that? If the user run the site from Safari, it works fine and does not ask the user to relogin.
You have probably found this out ages ago but I'm gonna leave this answer here for those who find this when searching for the problem.
This happens when the cookie is not set with an expiry date. iOS clears the cookies without an expiry date on load. Much like browsers do when they are restarted. Just add expiry to the cookie and the world will be fine again.
精彩评论