Eclipse Appcache Generator - auto-generate HTML5 appcache files

HTML5 Appache

I won't go into a full explanation here (if you want a tutorial the HTML5 Rocks website) but HTML5 appache is a method of caching web content so that, when offline, it can still be accessed

One method of doing this is to add a meta tag to each page specifying an appcache file, which will tell the browser to cache that page. But what if you want to tell the browser to cache everything when the site is first accessed? Well HTML5 has a way of doing that too - you still add the meta tag but also specify the files to be cached in the file. When it is accessed, those files will be cached. This though leaves you with a problem - how do you make sure you locate every file to be cached and add them to the file? This is where this plugin can help


The Appcache Eclipse Plugin is a plugin for the Eclipse IDE that will check all your files for your site and add all html, image, css and javascript files to the appcache. Once the plugin is installed, all you need to do is add the click the menu button and add the meta tag to your page(s)

At the moment it will create an appcache file for the folder selected and all subfolders. This will be improved over time to add additional useful features


As this is a plugin, you need to download the Eclipse IDE. Using Eclipse is beyond the scope of these instructions

Often there are 2 methods of installing an Eclipse plugin - direct download or update site. Our update site is coming soon, so direct download of the jar file is the only option for now


Once you have download the jar file, simple copy it into the plugins folder of Eclipse install folder. The path should be <ECLIPSE HOME> - plugins

Now restart Eclipse if it was already running. The plugin should now be installed

Generate an appcache file

Inside Eclipse, in either the Project Explorer or Navigator, right click on root folder of your website. By default this will be called WebContent. You should see a menu option called Generate Appcache

Clicking this menu option will generate an appcache folder in your web root folder called appcache.appcache. You can rename it to whatever you like, but the rest of the instructions will assume you leave it as appcache.appcache

Link to your pages

On each html page you will need to add an HTML5 appcache argument. This goes in the <html> tag like this:

<html manifest="appcache.appcache">

This is all you need to do except ensure your web server serves the appcache file correctly. There are some good instructions on the HTML5 Rocks site


This should make generating full-website appcache a whole lot easier.  The plugin is open source so if you have any feature requests, or want to contribute, head over to the appcache pages on the website


Popular posts from this blog

Launch a website as a mobile app using PhoneGap/Apache Cordova

How to manually add Cordova plugins to your app

Adding Multiple Google Accounts to Kindle Fire