htmlsingle-page-applicationhtml5-appcacheweb-app-manifest

How can I use Web App Manifest and Application Cache at the same time?


I'm trying to build a simple single HTML page that can be launched when offline (on Android, if that matters).

I'm using the Web App Manifest to give the app a name for adding to the home screen and display fullscreen with no browser chrome. This much works.

<!DOCTYPE html>
<html>
<head>
<link rel="manifest" href="mf.webmanifest">
<meta name="mobile-web-app-capable" content="yes">
</head>
...
</html>

This does not appear to be cached when offline. Separately, I can make a page which is cached offline using the application cache:

<!DOCTYPE html>
<html manifest="mf.appcache">
<head>
<meta name="mobile-web-app-capable" content="yes">
</head>
...
</html>

However, when I try to combine these two (so I can have an offline-cached page that launches fullscreen), the Web App Manifest is ignored and I only get the offline behaviour as in the second example.

What I ultimately want is a single page that can be added to the home screen, that opens full screen with no browser/OS chrome at all, and is cached for use offline. A solution that works just on Android using Chrome 65 is acceptable.


Solution

  • The Service Workers feature provides the same capabilities as the deprecated Application Cache.

    MDN has an article on Using Service Workers which I found very helpful in implementing what I needed to replace the Application Cache.