Time for action – adding the AppCache Manifest
Perform the following set of steps to take the game offline:
- In the
index.html
file, we add amanifest
attribute:<html lang="en" manifest="game.appcache">
- Then we create a file named
game.appcache
with the following content:CACHE MANIFEST # 2015-03-01:v3 CACHE: index.html css/matchgame.css images/bg.jpg images/deck.png images/popup_bg.jpg images/table.jpg js/jquery-1.11.2.min.js js/html5games.matchgame.js # Resources that require the user to be online. NETWORK: *
- In order to test the caching, we need to host the game online. Upload the project folder to a web server, then open the game and inspect the console, we should see messages about the browser downloading or using the AppCache resources, as shown ...
Get HTML5 Game Development by Example : Beginner's Guide - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.