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 in the following screenshot:
We just added an AppCache Manifest file to our index.html
file. Now once the game is loaded, it works in offline and airplane mode.