juggie / AlarmServer

Envisalink 2DS/3/4 Alarm Server (Proxy & HTTP/JSON)
72 stars 67 forks source link

New tornado version doesn't work as iOS Homescreen Web App #54

Open gerstl opened 8 years ago

gerstl commented 8 years ago

I just upgraded to the new tornado version (master branch) of AlarmServer, but this version doesn't seem to work as web app on an iDevice home screen. Used to work before.

I already deleted the icon and re-added it, but when launched as web app, it just shows the black "Alarm Server" banner on top, but otherwise an empty/blank page.

It all works fine in the Safari browser, just not as home screen web app icon.

gerstl commented 8 years ago

It looks like the problem may be with Apple's caching policy for web apps, so it would just show some stale/old code/page.

Some Googling suggested to trick iOS into thinking that the page is dynamic (= can't be cached) by appending something like "/?refresh=1" to the URL. That seems to have worked (just be sure to not use "?v=xxx", since that tells tornado to serve a page that enforces caching).

Nevertheless, ideally, this should really be fixed on the server side (by including some appropriate headers to tell iOS about caching policies?!).

juggie commented 8 years ago

I don't have an iDevice to test this on, but I think this was due to my use of StaticFileHandler for some stuff. I've overridden it to enforce no-cache. Let me know.

gerstl commented 8 years ago

Hard to say. Still doesn't work here for me, but that may have to do with iOS still having the old version cached on my phone. Don't know how to purge the cache for web apps (apparently, that cache is different from Safari's cache, and iOS caches very aggressively for web apps). In other words, I don't understand enough about iOS web app development to really know what to do beyond that...

juggie commented 8 years ago

So far as I can tell everything looks good and the no caching headers are properly set. Without a ipad/iphone/etc to test on, I can't provide any further help. I'd be happy to make the required changes if I knew what they were.

gerstl commented 8 years ago

I am in the same boat, wouldn't know what is needed otherwise. The solution with using a link that includes a "/index.html?refresh=xxx" works for me, so I am good (BTW, note: for some odd reason, the workaround only works around for me if I explicitly link to index.html, just doing "/?refresh=xxx" didn't do it for me).