HTML manifest files are a hot topic. It’s powerful, convenient and easy to implement but they come with a lot of new rules you have to bear in mind when using them. Let’s keep it simple for the moment. First here’s a very simple thing for you to remember when you use manifest files on a mobile phone: A mobile browser is not a desktop browser. Even if that goes without saying, this means a lot to the way we can develop and distribute mobile web apps. J
A manifest file is used in a mobile web application to create a consistent set of files your app runs from. These files are cached locally and the phone doesn’t need any network connection to run the app. But what happens if a file is requested but not part of the manifest bundle?
The browser can try and get the missing resource from the server if there is one, therefore creating a connection. This would ask the user to connect to the network if he is not and come up with either the file, a 404 or connection error. This would trigger a fair few annoying pop-ups every time you use the app in the tube. I have to say this proactive approach is good when you have a reliable and permanent connection like on desktop browsers. And they seem to behave just like this.
On a phone it’s a different story. Most of the mobile browsers went for another option: fail fast. Nothing happens and your file is considered missing even though it’s available on the server.
This leads me to one simple fact: your mobile app might run just fine on a desktop browser but might not work at all on your phone. This means that you should test on mobile browsers as early as possible! It’s convenient to test against a desktop browser but never forget the target.
Cherry on the gateau, implementation of the manifest files are not flawless on handsets:
- iOS 4 / 5 and Android seem to be working-ish. Though, I had to force the manifest to expire straightaway to make sure it’s checked against the server at every startup. On Tomcat, you can use an expiryFilter for that.
- Blackberry OS6 and Nokia S60 V5 don’t seem to support anything but offline web apps. I haven’t managed to get the manifest file being checked against the server at every startup. It seems like once it’s got a manifest and the associated set of files, there is no way to update it apart from deleting the cache manually from the browser options.
So, if you are considering using a manifest in a mobile web app, consider your real needs and the platforms you’re targeting. This will save you massive headaches. If what you need is JUST caching images, don’t snob off-screen caching…