18

This is regarding HTML5 offline apps on Android devices.

We are running into an issue where bookmarking an offline capable HTML5 app (with a complete cache manifest file) fails to load on the Android browser under the following conditions:

  1. Bookmark the app on the browser
  2. Switch off all wireless connectivity
  3. Close the browser completely
  4. Attempt to launch the bookmark from the homescreen

We end up with an "Unable to connect to the internet" message. The app works perfectly fine on iOS devices when saved to homescreen and on airplane mode.

Is there a specific way the app should be saved, or is this an Android specific quirk?

4
  • 3
    what browser are you using? the default android browser? Commented Feb 22, 2013 at 22:58
  • Could you add a link to your website? What android version are you testing this with? I have an offline web app and it works as expected. Commented Feb 26, 2013 at 21:27
  • Yup, we are seeing this in the default Android browser. Commented Feb 26, 2013 at 21:44
  • Which version of android is this? I have faced similar issues with android and a couple of times on chrome too. stackoverflow.com/questions/12932685/… Commented Feb 26, 2013 at 21:49

5 Answers 5

5
+50

I'd check and see that:

  1. MIME type really is text/cache-manifest.
  2. Your cache-manifest starts with CACHE MANIFEST, your urls thereafter are either relative to the manifest or absolute URLs.
  3. You don't have any broken links in your manifest, or a forced NETWORK: tag.
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Ben, turns out we are using a forced NETWORK tag. I will try it out without the tag and see how it goes.
2

So, I had faced similar issues with chrome and android on multiple instances. Apparently there is no issue with the implementation because I tried it on FF and it worked just fine, and the same was true about safari. The only thing I presume this is caused by is, the data is getting cache for the web page on the RAM when chrome is running. If you close the browser, and android ends the process a fresh instance of chrome is initialized and your existing app data is gone. I cannot confirm this, but it seems very likely that it might be the issue.

Also check your server is configured to send the mime type correctly: How to set up your server to send the correct MIME types

Comments

1

What's the file name of your cache manifest? I have heard that the extension could affect android's behavior. Make sure your file ends with .manifest

In addition, make sure your server is correctly serving the MIME type for manifest files, which is text/cache-manifest

1 Comment

Can confirm that both of these are true and still unable to get this to function properly on Android devices
1

In addition to Ben Max Rubinstein's and Compid's answer, if your app url is something like this: example.com/myapp you need to add a following forward slash, like this: example.com/myapp/.

When you are online the server will redirect you automatically, but if your are offline obviously that cannot happen.

Comments

1

What I encountered was that the .manifest files in Apache's mime.types configuration was correctly set to text/cache-manifest and then several lines below was overwritten as application/x-ms-application (for compatibility with MS' ClickOnce thing). To resolve this I've taken different file name ending, namely .cachemanifest, configured correctly its mime type, restarted Apache, renamed manifest file as cache.cachemanifest, changed my <html> manifest attribute to point to this file, and then I was finally able to cache my web app on Android (there wasn't any problem in desktop browsers which apparently don't care about the mime type of cache manifest file). Hope this helps.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.