views:

854

answers:

1

Hi,

I have an built an iPhone webapp using PHP. The main (and only) page includes the apple-mobile-web-app-capable and apple-touch-fullscreen meta tags so that it can run fullscreen once added the the homescreen. However, it seems every time I launch the app from the homescreen, the cache version of the page is used instead of refreshing the page (and of course, I need the page to be updated on startup, and cannot use Ajax here - need to dynamically authenticate the user with SSO phpCAS). I did not use any manifest file and tried adding meta tags about cache without success. Does anybody know how to fix this?

Thanks

+1  A: 

What meta tags have you tried?

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">

<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">

should tell Safari not to cache, but I have not tried them.

You could use javascript to load your "real" startup page from the cached page using any of the standard techniques to make the URL unique, such as adding a random number.

That might even work for the main startup page, but I doubt it. Worth a try, though.

-

I suggest the cached page load a new page only if it is on the springboard:

UNTESTED suggestion:

window.onload = function () { if (navigator.standalone) { document.location.href = 'http://your.com/whatever.php?randomjunk=1234') } }

so if the page is in the browser it can give instructions on saving to the home screen and if it is run from the home screen it will load the real page.

GeoNomad
Thanks for helping.Yes I've tried the meta tags you mentioned, but it's still loading the cache. Note this happens only when the tag apple-mobile-web-app-capable is set to YES (but I need this because want the web to run fullscreen) and only when I use the icon on the Springboard. Adding a randomly generated token to the URL could fix this, but that would imply a redirection: so it wouldn't be possible to bookmark the homepage (which redirects after adding the token get paremeter...) anymore in Safari Mobile, it you see what I mean...Best
Benoit