Add some javascript stuff for better handling of appcache