0

The facts

I'm building an HTML 5 responsive website with an offline mode. To do that, I'm using a manifest file with a FALLBACK section and the browser's localStorage to store the pages that the users decide to save for offline access.

Everything is working great both on desktop or iPhone (haven't tested it on Android yet), except when I add a NETWORK section to the manifest file.

Why do I need the NETWORK section ? I need it for Google Analytics to work - otherwise my website's users won't get tracked, even if the user if online (that's how HTML5 applicationCache works). So this really is mandatory.

On the desktop, this is not an issue, I can turn off the Internet connection and the website works in offline mode.

On the iPhone, however, if i'm turning off the Internet connection (for instance turning on airplane mode) I'm not able to start the web-app (meaning my website added to the home screen) once the NETWORK section is added to the manifest : i'm prompted by iOS to turn on the Internet connection, and the app is closing. If there's no NETWORK section in the manifest file, everything runs fine.

My question

is twofold :

1) while I can understand that there is some logic behind such behaviour, it seems very strange (well, almost unbelievable) to me that you can't have an iOS web-app working in offline mode if there is the slightest attempt to access the network - I've read numerous tutorials about applicationCache on iOS and no one ever mention the NETWORK section's incompatibility with airplane mode. So, does anyone can confirm (or infirm) what I'm experiencing ?

2) If there is indeed such incompatibility, the only workaround I can imagine is having a dynamically build manifest file server-side, adding a NETWORK section for desktop users only - but that means forgetting about tracking mobile online users, which is not acceptable. So, does anyone have a better idea ?

Jérôme Morlon
  • 191
  • 1
  • 7

1 Answers1

0

Oops, I should have looked better on SO : this has already been answered here :

https://stackoverflow.com/a/6285955/2251905

Following the steps outlined in the abover answer solved the problem. This has nothing to do with the NETWORK section (thankfully and rightfully !), but with what seems to be an annoying iOS bug on the iPhone.

Community
  • 1
  • 1
Jérôme Morlon
  • 191
  • 1
  • 7