Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS: Did Apple disable HTML5 offline capability for web apps saved to the home screen?

I've been doing lots of work in getting a few web apps to work offline on iOS using the HTML5 manifest. I've ran across the typical problems everyone else has and fixed them and everything seems to be working fine—except in the case where I save the web app to the desktop on my iPhone 4.

If I do this and then enable airplane mode, I get the following alert when trying to access the app via the home screen: "your-app-name could not be opened because its not connected to the internet." Accessing the app via Safari browser works fine while offline.

If anyone knows if this is an error on my part, or even the slim possibility of a work around, do tell.

Even downloading the new Financial Times web app (very well done with extensive localStorage support) results in an error when accessing it offline from the home screen.

Technical specs: Running iPhone 4 with iOS 4.3.3 (but also saw the issue in 4.3.2)

like image 386
Mauvis Ledford Avatar asked Jun 07 '11 18:06

Mauvis Ledford


Video Answer


2 Answers

After reading the comments (especially Rowan's) I ran more tests and found the answer:

No, Apple did not disable HTML5 offline capability for web apps saved to the home screen, it works - for the most part. There is a bug that will make it not work. It doesn't seem to have anything to do with your manifest setup (unless perhaps it downloaded a bad manifest or incomplete manifest at one point.) We don't know how widespread it is but the fix is to clear your Mobile Safari Cache.

Here's the steps:

  1. Close the web app (make sure its not sticking around in the background).
  2. Cleared Mobile Safari cache: Settings > Safari > Clear Cache
  3. Reopened the app (for caching).
  4. Close the web app again (make sure its not sticking around in the background).
  5. Enabled "Airplane Mode": Settings > Airplane Mode
  6. Reopened the app.

It should now work offline. If it doesn't then its probably a separate manifest issue in your app. Looks like a weird bug with the browser cache - or perhaps the cache was completely full? Who knows, but that's the answer. Thanks guys.

like image 70
Mauvis Ledford Avatar answered Sep 22 '22 15:09

Mauvis Ledford


iOS seems to be very sensitive to load issues when offline.

I was getting your "could not be opened" error when offline on a page I was working on. The problem turned out to be that the page created an iframe pointing to a site that didn't have an AppCache. Removing those iframes fixed the issue.

In my case, I handled it using window.navigator.standalone which tells you whether you're running in an iOS homescreen app. The code looked like this:

if (!navigator.standalone) insertFrames(); 
like image 37
Dan Fabulich Avatar answered Sep 21 '22 15:09

Dan Fabulich