HTML and CSS Reference
In-Depth Information
apps , on the other hand, are downloaded to the user's computer and can be used offline without any additional
work. Hosted apps can also be used offline if they are configured to properly use an application cache manifest.
Creating a Hosted App
Creating a hosted app for the Chrome browser for testing purposes is as simple as creating a directory with the
required manifest and icon and then loading it as an unpackaged extension from within Chrome.
To walk through the required steps, you turn the Alien Invasion game, hosted on github pages at ht-
tp:// , into a hosted app.
First, create a new folder called invasion-app . Next, create a manifest.json file in that directory with the
contents of Listing 27-1 .
Listing 27-1: Invasion app manifest.json
"name": "Alien Invasion",
"description": "Save the world, you know the drill...",
"version": "1.0.0",
"app": {
"urls": [
"launch": {
"web_url": ""
"icons": {
"128": "invasion_128.png"
"offline_enabled": true,
"permissions": [
This manifest file has a few important parts. The first are the basic information fields: name, description,
and version. These all appear in the extensions screen and provide information to the user. Next is the app in-
formation that lets Chrome know what urls should be allowed in the permissions listed at the bottom of the
manifest. (In this case, no additional permissions are needed.) The app information also includes the launch
information. Because this is a hosted app, you need to include a web_url from where to launch the app.
For icons , you need to specify only a 128 x 128 pixel icon. To match the size of other icons, it should fill
up only approximately a 96-pixel box and have a 16-pixel transparent border on each side (see Google's image
guidelines for more details: .
Next, if your app supports application cache, you can set the offline_enabled key to true , and the
icon for your game won't be grayed-out in the launch screen when the browser is offline.
Finally, there are additional permissions you can request that your app receives by default without needing
to ask the user each time your app loads. The available permissions are background , clipboardRead ,
Search WWH ::

Custom Search