mozilla

Revision 331225 of App manifest

  • Revision slug: Apps/Manifest
  • Revision title: App manifest
  • Revision id: 331225
  • Created:
  • Creator: jds2501
  • Is current revision? No
  • Comment

Revision Content

An Open Web App manifest contains information that a Web browser needs to interact with an app. A manifest is one of the key things that distinguish an Open Web App from a website. It is a JSON file with a name and description for the app, and it can also contain the origin of the app, icons, and the permissions required by the app, among other things. The browser that handles the manifest must incorporate a Web runtime.

To self-publish an app from a page that you control, you trigger installation of the app (for example, by calling navigator.mozApps.install() from a button). When a store or marketplace publishes an app, it triggers installation of the app by providing the browser with the URL of the manifest of the hosted app.

See About app manifests for a FAQ.

Example manifest

The following is a minimal manifest. You can copy it into a text file and replace the values with your own information.

Note: Your app might need more than just a minimal manifest. See the documentation below on all manifest fields.

{
  "name": "My App",
  "description": "My elevator pitch goes here",
  "launch_path": "/",
  "icons": {
    "128": "/img/icon-128.png"
  },
  "developer": {
    "name": "Your name or organization",
    "url": "http://your-homepage-here.org"
  },
  "default_locale": "en"
}

Manifest fields

The following fields are allowed in the manifest. The fields in your manifest can be in any order. Fields in the manifest other than the ones given below will be ignored.

name

(required) A human-readable name for the app (maximum length is 128 characters).

description

(required) A human-readable description of the app (maximum length is 1024 characters).

launch_path

(optional, required for packaged apps) The path within the app's origin that is loaded when the app starts. If not provided, the app's origin is treated as the launch domain URL. See Path Handling.

In a packaged app, this field specifies the starting point of the content local to the zip file containing the packaged app. For example, if launch_path has a value of /myApp/index.html, when the packaged app is launched it will open the file /myApp/index.html.

icons

(optional) A map of icon sizes to URIs of the icons (which may be absolute paths, relative or data URIs). Icons must be square and are intended to visually represent the app. Icons should not have solid backgrounds that extend to all four corners of the icon. Paths beginning with "/" are treated as relative to the origin of the app.

For Windows 7 and Android, the following icon sizes are supported:

  • 16 x 16
  • 32 x 32
  • 48 x 48
  • 64 x 64
  • 128 x 128
  • 256 x 256

For Firefox OS icons should be provided without a drop shadow and a close cropped canvas in the following sizes:

  • 30 x 30
  • 60 x 60

You can download preliminary app icon guidelines for Firefox OS. Final style guidelines are coming soon at http://www.mozilla.org/en-US/styleguide/.

Note: Firefox Marketplace requires all submitted apps to have a minimum of one icon that is at least 128 x 128.

You can specify multiple icons like this example:

"icons": {
  "16": "/img/icon-16.png",
  "48": "/img/icon-48.png",
  "128": "/img/icon-128.png"
}

csp

(optional) Specify a Content Security Policy for the app. CSP syntax is described at https://wiki.mozilla.org/Security/CSP/Specification

Note that for privileged and certified apps there are default CSPs that do not require this field in the manifest. The CSP that you specify here for privileged and certified apps must be stricter than the default CSPs. The default CSPs for privileged and certified and apps are:

Privileged:
"default-src *; script-src 'self'; object-src 'none'; style-src 'self' 'unsafe-inline'"

Certified:
"default-src *; script-src 'self'; object-src 'none'; style-src 'self'"

type

(optional) The app's type, which can be webprivileged, or certified. These types are described below.

  • web - A regular app. Permissions are limited to those listed in this manifest in the permissions field. If you do not specify the type field in the manifest, web is the default.
  • privileged - An authenticated Open Web App that has been approved by an app store such as the Firefox Marketplace. It is meant to provide more security for a user when an app wants access to certain sensitive APIs on a device. A privileged app is equivalent in capability and security to apps on other mobile platforms. It is a packaged app (all resources contained in a zip file) that has the following additional characteristics:
    • Approved by an app store after code review or equivalent.
    • Has an app manifest signed by the app store.
    • Uses a Content Security Policy.
    • Implements other things related to security. For more information see Security.
  • certified - An Open Web App that is intended for a critical system function like the default dialer or system settings app on a smartphone. It is not intended for 3rd party apps in an app store. A certified app is a packaged app that is similar to a privileged app, except that all device permissions are implicit. It must be approved by the OEM or carrier for the device that uses it.

Example:

"type": "privileged"

developer

(optional) Information about the developer of the app. It has these properties:

  • name - The name of the developer.
  • url - The URL of a site containing more information about the app's developer. This URL is typically rendered when the user clicks on the name of the app's developer while viewing details about an app inside the dashboard (or browser).

locales

(optional) A map of locale-specific overrides of the data contained in the manifest, which UIs use to provide localized views. Each locale entry is keyed on a locale tag and contains a sparse representation of the manifest. Any field that is present in the locale value overrides the matching field in the manifest. Certain fields cannot be overridden, including default_localelocales itself and installs_allowed_from. A manifest that overrides any of these fields is invalid. When locales is present, default_locale must also be present. Example:

"locales": {
  "es": {
    "description": "¡Acción abierta emocionante del desarrollo del Web!",
    "developer": {
      "url": "http://es.mozillalabs.com/"
    }
  },
  "it": {
    "description": "Azione aperta emozionante di sviluppo di fotoricettore!",
    "developer": {
      "url": "http://it.mozillalabs.com/"
    }
  }
}

default_locale

(required when locales is present) The locale tag for the "default" translation of manifest properties. That is, the locale of values not included in the locales map.

installs_allowed_from

(optional) An array of origins (scheme+domain, for example https://marketplace.example.com) that are allowed to trigger installation of this app. This field allows you to explicitly allow only certain sites or stores, with whom you have a relationship, to install your app. The array ["*"] means that installations of this app are allowed from any site. This is the default.  Note that [] would disallow installation from any site, including your own site. Here is an example of allowing installations from any site:

"installs_allowed_from": ["*"]

Note: Do not put a trailing slash at the end of URLs in this array. For example, this is incorrect: https:/marketplace.example.com/. If you use a trailing slash, the installation will fail. There is a bug on this here.

Note: If one of the URLs is the Firefox Marketplace, you must use https://marketplace.firefox.com/. There was an earlier URL for the Marketplace but it changed on November 15, 2012. The earlier URL was https://marketplace.mozilla.org/, and it no longer works. If your app uses the earlier URL, you will have to change it.

version

(optional) A string that represents the version of the manifest. The Web runtime does not use this value in any way, so this can be any value. You can embed this string into the manifest and extract it to help deal with various update cases. See the section on updating below.

orientation

(Android & Firefox OS only, optional) A comma-separated list that defines the orientation at which the application will stay locked in even if the device orientation changes. Can be one of "portrait", "landscape", "portrait-primary", "landscape-primary", "portrait-secondary" or "landscape-secondary". The options with primary and secondary lock the orientation in only one device orientation, even if the device orientation changes. The options without primary and secondary combine both rules of primary and secondary together. The options additionally suffixed with "-secondary" imply a 180 degree rotation from the options without the suffix. For instance, holding the phone upside down (but still in a manner where width is less than height), implies the "portrait-secondary" orientation. If this field has a valid value, the runtime will not change the orientation of the view rendering the application even if the device is turned. Example:

"orientation": "portrait,landscape-secondary"

permissions

(optional) The set of permissions that the app needs. An app must list every API it intends to use that requires user permission. If an app tries to use one of these APIs without a corresponding entry in this field, it will fail.

The permissions field is an object, with each property specifying a single permission. Each API entry must have a description property. Some APIs also require an access property. Example of the permissions field:

"permissions": {
  "contacts": {
    "description": "Required for autocompletion in the share screen",
    "access": "readcreate"
  },
  "alarms": {
    "description": "Required to schedule notifications"
  }
}
  • description - A string specifying the intent behind requesting use of this API. This property is mandatory.
  • access - A string specifying the type of access required for the permission. This property is only required for a few APIs. The possible values are readreadwritereadcreate, and createonly.

The permissions APIs are listed below. If an API requires an access property, it is mentioned. For more information on where these permissions are supported, see App permissions.

  • alarms - Schedule a notification, or schedule an application to be started.
  • backgroundservice - Enable a web application to run in the background and perform tasks like syncing or responding to incoming messages.
  • bluetooth - Low level access to Bluetooth hardware.
  • browser - Enables implementing a browser.
  • camera - Take photos, shoot video and control the camera.
  • contacts -  Add, read, or modify contacts from the address book on the device and read contacts from the SIM. Access property required: one of readonlyreadwritereadcreate, or createonly.
  • desktop-notification - Display a notification on the user's desktop.
  • device-storage - Add, read, or modify files stored at a central location on the device. Access property required: one of readonlyreadwritereadcreate, or createonly.
  • fmradio - Control the FM radio.
  • geolocation - Obtain the current location of the user.
  • mobileconnection - Obtain information about the current mobile voice and data connection.
  • power - Turn the screen on or off, control CPU, device power, and so on. Listen for and inspect resource lock events.
  • push - Receive push events.
  • settings - Configure or read device settings. Access property required: one of readonly or readwrite.
  • sms - Send and receive SMS.
  • storage - Utilize localStorage and indexedDB without size limitations.
  • systemclock - Set current time. (Time zone information is controlled by the settings API.)
  • network-http - Make HTTP requests without any origin restrictions.
  • network-tcp - Create and communicate over TCP sockets.
  • telephony - Access all telephony-related APIs.
  • wake-lock-screen - Turn the display on and show the lock screen.
  • webapps-manage - Obtain access to the navigator.mozApps.mgmt API to manage installed Open Web Apps.
  • wifi - Enumerate available WiFi networks, get signal strength, connect to a network.

fullscreen

(Firefox OS only, optional) Set this to true or false to indicate whether the runtime should launch the app in full-screen mode. Example:

"fullscreen": "true"

appcache_path

(optional) The absolute path to the application cache (AppCache) manifest.  When an Open Web App is installed, the AppCache manifest will be fetched and parsed, and its static assets under the CACHE header will be cached.

"appcache_path": "/cache.manifest"

activities

(Firefox OS only, optional) Specifies a set of Web Activities that this app supports. Each property in this field is an activity. Activity names are free-form text, and each activity is represented by an object. Here is an example activities field with one activity named share:

"activities": {
  "share": {
    "filters": {
      "type": [ "image/png", "image/gif" ]
    },
    "href": "foo.html",
    "disposition": "window"
  }
}

The object for the share activity in the example has three properties: filters, href, and disposition. These are described below.

  • href - (required) When another app or web page initiates an activity that is supported by this app, if this app is chosen to perform the activity, this specifies the page that will be opened. It will be opened in the manner specified by the disposition property.
  • disposition - (optional) Specifies how the page specified in href is presented when an activity is invoked. The value, if specified, must be one of the following (if omitted, defaults to window):
    • window - The page handling the activity is opened in a new "window" (on a mobile device this view will replace the original app that requested the activity). The page must call navigator.setMessageHandler for each activity it supports and subsequently execute the activity for which it receives a message. Further, if the activity requires a return value, the page must call activity.postResult or activity.postError (where activity is the first argument provided to the function specified by setMessageHandler) as appropriate. These functions are specified in greater detail in Web Activities.
    • inline - The page that handles the activity will open in an overlay (on a mobile device this will be rendered in a popup over the original app that requested the activity). Subsequent behavior is exactly the same as if disposition were window.
  • filters - (optional) A dictionary, each property of which specifies a filter. These filters will be applied while determining apps suitable for handling a given activity. Filter names are free-form text, but their values must be either a string or an array of strings (the exact type depends on the filter).

Path handling

All fields that hold paths in the manifest must be absolute paths (for example, /images/myicon.png), and the paths must be served from the same origin as the app.

Also, there are two ways to set launch_path:

  • If your app is stored in the root of a Web server, for example mywebapp.github.com/, then launch_path must be set to /.
  • Otherwise, if your app is stored in a subdirectory, for example mymarket.github.com/mywebapp/, then launch_path must be set to /mywebapp/.

Serving manifests

The app manifest must be served from the same origin that the app is served from.

When served from static files, it is recommended that the manifest be stored with a file extension of .webapp.  App manifests must be served with a Content-Type header of application/x-web-app-manifest+json (Note: this is currently not enforced by Firefox but is by the Marketplace). Manifests can be served over SSL to mitigate certain classes of attacks.

The document must be UTF-8 in order for the app to be submitted to Firefox Marketplace. It is recommended to omit the byte order mark (BOM). Other encodings can be specified with a charset parameter on the Content-Type header (i.e. Content-Type: application/x-web-app-manifest+json; charset=ISO-8859-4), though this will not be respected by the Marketplace.

User Agents when possible should meaningfully message the site identity and TLS status when prompting a user to install an app.

Serving from Apache

In your .htaccess file, you MUST add the following:

AddType application/x-web-app-manifest+json .webapp
Note: This assumes you're using .webapp as an extension. If you are using .json or another extension, you will have to update the code to reflect that.

If you don't have a .htaccess file, create it in the root directory of your server. If this doesn't work, your host may require you to also add AddHandler x-web-app-manifest+json .webapp.

Serving from NGINX

You need to edit your mime.types file in the conf directory. This will probably be located in either /etc/nginx/ or /opt/nginx/.

You should have something similar to below. Add in the bold line.

types {
  text/html   html htm shtml;
  text/css    css;
  text/xml    xml;
  application/x-web-app-manifest+json   webapp;
}
Note: This assumes you're using .webapp as an extension. If you are using .json or another extension, you will have to update the code to reflect that.
Serving from GitHub

If you serve your manifest file from GitHub Pages (http://pages.github.com/), GitHub will serve it with the Content-Type header of application/x-web-app-manifest+json. You must use the .webapp file extension on your manifest file. Example: manifest.webapp.

Updating manifests

An app respects the normal rules for Web caching, and may optionally use advanced mechanisms for improved start-up, like the HTML5 AppCache. Given this, there are no special considerations for updating the normal resources that an app uses.

Open Web Apps are different, however, in the handling of the manifest. Some changes to a manifest may require user approval. Depending on the implementation of the Web runtime, it may be unclear whether an update has occurred.

As a clean way to deal with this issue, you can provide a version field in the app manifest. You can later check the version by inspecting the return value of the navigator.mozApps.getInstalled() function. If the user's installed version is not up-to-date, you can trigger an update using navigator.mozApps.install().

The value of version is not used by the Web runtime, so you can use whatever versioning scheme you want.

Also note that changes to a manifest that introduce errors or other breakage will be detected if the manifest has been submitted to Firefox Marketplace. Serious errors will cause the app's listing to be disabled. Less serious errors may automatically flag the app for re-review.

Revision Source

<div class="wikistyle">
  <p>An Open Web App <strong>manifest</strong> contains information that a Web browser needs to interact with an app. A manifest is one of the key things that distinguish an Open Web App from a website. It is a <a href="http://www.json.org/" title="http://www.json.org/">JSON</a> file with a name and description for the app, and it can also contain the origin of the app, icons, and the permissions required by the app, among other things. The browser that handles the manifest must incorporate a <a href="/en-US/docs/Apps/Apps_architecture#Web_runtime" title="/en-US/docs/Apps/Apps_architecture#Web_runtime">Web runtime</a>.</p>
  <p>To self-publish an app from a page that you control, you trigger installation of the app (for example, by calling <a href="/en/DOM/Apps.install" title="en/Apps/Apps_JavaScript_API/navigator.mozApps.install"><code>navigator.mozApps.install()</code></a> from a button). When a store or marketplace publishes an app, it triggers installation of the app by providing the browser with the URL of the manifest of the hosted app.</p>
  <p>See <a href="/en/Apps/FAQs/About_app_manifests" title="https://developer.mozilla.org/en/Apps/FAQs/About_app_manifests">About app manifests</a> for a FAQ.</p>
  <h2 id="Example_manifest">Example manifest</h2>
  <p>The following is a minimal manifest. You can copy it into a text file and replace the values with your own information.</p>
  <div class="note">
    <p><strong>Note:</strong> Your app might need more than just a minimal manifest. See the documentation below on all manifest fields.</p>
  </div>
  <pre class="brush: js">
{
&nbsp; "name": "My App",
&nbsp; "description": "My elevator pitch goes here",
&nbsp; "launch_path": "/",
&nbsp; "icons": {
&nbsp;&nbsp;&nbsp; "128": "/img/icon-128.png"
&nbsp; },
&nbsp; "developer": {
&nbsp;&nbsp;&nbsp; "name": "Your name or organization",
&nbsp;&nbsp;&nbsp; "url": "http://your-homepage-here.org"
&nbsp; },
&nbsp; "default_locale": "en"
}
</pre>
  <h2 id="Manifest_fields">Manifest fields</h2>
  <p>The following fields are allowed in the manifest. The fields in your manifest can be in any order.&nbsp;Fields in the manifest other than the ones given below will be ignored.</p>
  <h3 id="name">name</h3>
  <p>(required) A human-readable name for the app (maximum length is 128 characters).</p>
  <h3 id="description">description</h3>
  <p>(required) A human-readable description of the app (maximum length is 1024 characters).</p>
  <h3 id="launch_path">launch_path</h3>
  <p>(optional, required for packaged apps) The path within the app's origin that is loaded when the app starts. If not provided, the app's origin is treated as the launch domain URL. See <a href="#path-handling">Path Handling</a>.</p>
  <p>In a <a href="/en-US/docs/Apps/Packaged_apps" title="/en-US/docs/Apps/Packaged_apps">packaged app</a>, this field specifies the starting point of the content local to the zip file containing the packaged app. For example, if <code>launch_path</code> has a value of <code>/myApp/index.html</code>, when the packaged app is launched it will open the file <code>/myApp/index.html</code>.</p>
  <h3 id="icons">icons</h3>
  <p>(optional) A map of icon sizes to URIs of the icons (which may be <a href="#Path_handling">absolute paths</a>, relative or data URIs). Icons must be square and are intended to visually represent the app. Icons should not have solid backgrounds that extend to all four corners of the icon.&nbsp;Paths beginning with "/" are treated as relative to the origin of the app.</p>
  <p><span style="line-height: normal;">For Windows 7 and Android, the following icon sizes are supported:</span></p>
  <ul style="line-height: normal;">
    <li>16 x 16</li>
    <li>32 x 32</li>
    <li>48 x 48</li>
    <li>64 x 64</li>
    <li>128 x 128</li>
    <li>256 x 256</li>
  </ul>
  <p style="line-height: normal;">For Firefox OS icons should be provided without a drop shadow and a close cropped canvas in the following sizes:</p>
  <ul style="line-height: normal;">
    <li>30 x 30</li>
    <li>60 x 60</li>
  </ul>
  <p style="line-height: normal;">You can download <a href="https://www.dropbox.com/s/s410cswqr6w0g2i/MozillaFXOSAppIconGuidelines.zip" title="https://www.dropbox.com/s/s410cswqr6w0g2i/MozillaFXOSAppIconGuidelines.zip">preliminary&nbsp;app icon guidelines</a> for&nbsp;Firefox OS. Final style guidelines are coming soon at&nbsp;<a href="http://www.mozilla.org/en-US/styleguide/" title="http://www.mozilla.org/en-US/styleguide/">http://www.mozilla.org/en-US/styleguide/</a>.</p>
  <div class="note">
    <p><strong>Note:&nbsp;</strong>Firefox Marketplace requires all submitted apps to have a minimum of one icon that is at least 128 x 128.</p>
  </div>
  <p style="line-height: normal;">You can specify multiple icons like this example:</p>
  <pre class="brush:js;" style="font-size: 14px;">
"icons": {
&nbsp; "16": "/img/icon-16.png",
&nbsp; "48": "/img/icon-48.png",
&nbsp; "128": "/img/icon-128.png"
}</pre>
  <h3 id="csp">csp</h3>
  <p><span style="line-height: normal;">(optional) Specify a Content Security Policy for the app.&nbsp;CSP syntax is described at&nbsp;</span><a href="https://wiki.mozilla.org/Security/CSP/Specification" style="line-height: normal;" title="https://wiki.mozilla.org/Security/CSP/Specification">https://wiki.mozilla.org/Security/CSP/Specification</a><span style="line-height: normal;">.&nbsp;</span></p>
  <p style="line-height: normal;">Note that for <a href="/en-US/docs/Apps/Packaged_apps" title="/en-US/docs/Apps/Packaged_apps">privileged and certified apps</a> there are default CSPs that do not require this field in the manifest.&nbsp;The CSP that you specify here for privileged and certified apps must be stricter than the default CSPs.&nbsp;The default CSPs for&nbsp;privileged and&nbsp;certified and apps are:</p>
  <pre style="font-size: 14px;">
Privileged:
"default-src *; script-src 'self'; object-src 'none'; style-src 'self' 'unsafe-inline'"

Certified:
"default-src *; script-src 'self'; object-src 'none'; style-src 'self'"</pre>
  <h3 id="type">type</h3>
  <p><span style="line-height: normal;">(optional) The app's type, which can be&nbsp;</span><code style="font-size: 14px;">web</code><span style="line-height: normal;">,&nbsp;</span><code style="font-size: 14px;">privileged</code><span style="line-height: normal;">, or&nbsp;</span><code style="font-size: 14px;">certified</code><span style="line-height: normal;">. These types are described below.</span></p>
  <ul style="line-height: normal;">
    <li><strong>web</strong>&nbsp;- A regular app. Permissions are limited to those listed in this manifest in the permissions field. If you do not specify the type field in the manifest,&nbsp;<code style="font-size: 14px;">web</code>&nbsp;is the default.</li>
    <li><strong>privileged</strong>&nbsp;- An authenticated Open Web App that has been approved by an app store such as the Firefox Marketplace. It is meant to provide more security for a user when an app wants access to certain sensitive APIs on a device. A privileged app is equivalent in capability and security to apps on other mobile platforms. It is a <a href="/en-US/docs/Apps/Packaged_apps" title="/en-US/docs/Apps/Packaged_apps">packaged app</a> (all resources contained in a zip file) that has the following additional characteristics:
      <ul>
        <li>Approved by an app store after code review or equivalent.</li>
        <li>Has an app manifest signed by the app store.</li>
        <li>Uses a&nbsp;<a href="/en-US/docs/Security/CSP" title="/en-US/docs/Security/CSP">Content Security Policy</a>.</li>
        <li>Implements other things related to security. For more information see&nbsp;<a href="https://wiki.mozilla.org/Apps/Security" title="https://wiki.mozilla.org/Apps/Security">Security</a>.</li>
      </ul>
    </li>
    <li><strong>certified</strong>&nbsp;- An Open Web App that is intended for a critical system function like the default dialer or system settings app on a smartphone. It is not intended for 3rd party apps in an app store. A certified app is a packaged app that is similar to a privileged app, except that all device permissions are implicit. It must be approved by the OEM or carrier for the device that uses it.</li>
  </ul>
  <p style="line-height: normal;">Example:</p>
  <pre style="font-size: 14px;">
"type": "privileged"</pre>
  <h3 id="developer">developer</h3>
  <p><span style="line-height: normal;">(optional) Information about the developer of the app. It has these properties:</span></p>
  <ul style="line-height: normal;">
    <li><strong>name</strong>&nbsp;- The name of the developer.</li>
    <li><strong>url</strong>&nbsp;-&nbsp;The URL of a site containing more information about the app's developer. This URL is typically rendered when the user clicks on the name of the app's developer while viewing details about an app inside the dashboard (or browser).</li>
  </ul>
  <h3 id="locales">locales</h3>
  <p><span style="line-height: normal;">(optional) A map of locale-specific overrides of the data contained in the manifest, which UIs use to provide localized views. Each locale entry is keyed on a&nbsp;</span><a class="external" href="http://www.ietf.org/rfc/rfc4646.txt" style="line-height: normal;">locale tag</a><span style="line-height: normal;">&nbsp;and contains a sparse representation of the manifest. Any field that is present in the&nbsp;</span><code style="font-size: 14px;">locale</code><span style="line-height: normal;">&nbsp;value overrides the matching field in the manifest. Certain fields cannot be overridden, including&nbsp;</span><code style="font-size: 14px;">default_locale</code><span style="line-height: normal;">,&nbsp;</span><code style="font-size: 14px;">locales</code><span style="line-height: normal;">&nbsp;itself and&nbsp;</span><code style="font-size: 14px;">installs_allowed_from</code><span style="line-height: normal;">. A manifest that overrides any of these fields is invalid. When&nbsp;</span><code style="font-size: 14px;">locales</code><span style="line-height: normal;">&nbsp;is present,&nbsp;</span><code style="font-size: 14px;">default_locale</code><span style="line-height: normal;">&nbsp;must also be present. Example:</span></p>
  <pre style="font-size: 14px;">
"locales": {
  "es": {
    "description": "¡Acción abierta emocionante del desarrollo del Web!",
    "developer": {
      "url": "http://es.mozillalabs.com/"
    }
  },
  "it": {
    "description": "Azione aperta emozionante di sviluppo di fotoricettore!",
    "developer": {
      "url": "http://it.mozillalabs.com/"
    }
  }
}</pre>
  <h3 id="default_locale" style="line-height: normal;">default_locale</h3>
  <p style="line-height: normal;">(required when&nbsp;<code style="font-size: 14px;">locales</code>&nbsp;is present) The locale tag for the "default" translation of manifest properties. That is, the locale of values not included in the&nbsp;<code style="font-size: 14px;">locales</code>&nbsp;map.</p>
  <h3 id="installs_allowed_from" style="line-height: normal;">installs_allowed_from</h3>
  <p style="line-height: normal;">(optional) An array of origins (scheme+domain, for example&nbsp;<code style="font-size: 14px;">https://marketplace.example.com</code>) that are allowed to trigger installation of this app. This field allows you to explicitly allow only certain sites or stores, with whom you have a relationship, to install your app. The array [<code style="font-size: 14px;">"*"]</code>&nbsp;means that installations of this app are allowed from any site. This is the default.&nbsp; Note that&nbsp;<code style="font-size: 14px;">[]</code>&nbsp;would disallow installation from any site, including your own site. Here is an example of allowing installations from any site:</p>
  <pre style="font-size: 14px;">
"installs_allowed_from": ["*"]</pre>
  <div class="note">
    <p><strong>Note:</strong>&nbsp;Do not put a trailing slash at the end of URLs in this array. For example, this is incorrect: <code>https:/marketplace.example.com/</code>. If you use a trailing slash, the installation will fail. There is a bug on this&nbsp;<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=755044" title="https://bugzilla.mozilla.org/show_bug.cgi?id=755044">here</a>.</p>
  </div>
  <div class="note">
    <p><strong>Note:</strong>&nbsp;If one of the URLs is the Firefox Marketplace, you must use <code>https://marketplace.firefox.com/</code>. There was an earlier URL for the Marketplace but it changed&nbsp;on November 15, 2012. The earlier URL was <code>https://marketplace.mozilla.org/</code>, and it no longer works. If your app uses the earlier URL, you will have to change it.</p>
  </div>
  <h3 id="version" style="line-height: normal;">version</h3>
  <p style="line-height: normal;">(optional) A string that represents the version of the manifest. The Web runtime does not use this value in any way, so this can be any value. You can embed this string into the manifest and extract it to help deal with various update cases. See the section on updating below.</p>
  <h3 id="orientation" style="line-height: normal;">orientation</h3>
  <p style="line-height: normal;">(Android &amp; Firefox OS only, optional) A comma-separated list that defines the orientation at which the application will stay locked in even if the device orientation changes. Can be one of "portrait", "landscape", "portrait-primary", "landscape-primary", "portrait-secondary" or "landscape-secondary". The options with primary and secondary lock the orientation in only one device orientation, even if the device orientation changes. The options without primary and secondary combine both rules of primary and secondary together. The options additionally suffixed with "-secondary" imply a 180 degree rotation from the options without the suffix. For instance, holding the phone upside down (but still in a manner where width is less than height), implies the "portrait-secondary" orientation. If this field has a valid value, the runtime will not change the orientation of the view rendering the application even if the device is turned. Example:</p>
  <pre style="font-size: 14px;">
"orientation": "portrait,landscape-secondary"</pre>
  <h3 id="permissions" style="line-height: normal;">permissions</h3>
  <p style="line-height: normal;">(optional) The set of permissions that the app needs. An app must list every API it intends to use that requires user permission. If an app tries to use one of these APIs without a corresponding entry in this field, it will fail.</p>
  <p style="line-height: normal;">The permissions field is an object, with each property specifying a single permission. Each API entry must have a&nbsp;<code style="font-size: 14px;">description</code>&nbsp;property. Some APIs also require an&nbsp;<code style="font-size: 14px;">access</code>&nbsp;property. Example of the permissions field:</p>
  <pre style="font-size: 14px;">
"permissions": {
  "contacts": {
    "description": "Required for autocompletion in the share screen",
    "access": "readcreate"
  },
  "alarms": {
    "description": "Required to schedule notifications"
  }
}</pre>
  <ul style="line-height: normal;">
    <li><strong>description</strong>&nbsp;- A string specifying the intent behind requesting use of this API. This property is mandatory.</li>
    <li><strong>access</strong>&nbsp;- A string specifying the type of access required for the permission. This property is only required for a few APIs. The possible values are&nbsp;<code style="font-size: 14px;">read</code>,&nbsp;<code style="font-size: 14px;">readwrite</code>,&nbsp;<code style="font-size: 14px;">readcreate</code>, and&nbsp;<code style="font-size: 14px;">createonly</code>.</li>
  </ul>
  <p style="line-height: normal;">The permissions APIs are listed below. If an API requires an&nbsp;<code style="font-size: 14px;">access</code>&nbsp;property, it is mentioned. For more information on where these permissions are supported, see <a href="/en-US/docs/Apps/App_permissions" title="/en-US/docs/Apps/App_permissions">App permissions</a>.</p>
  <ul style="line-height: normal;">
    <li><strong>alarms</strong> - Schedule a notification, or schedule an application to be started.</li>
    <li><strong>backgroundservice</strong>&nbsp;- Enable a web application to run in the background and perform tasks like syncing or responding to incoming messages.</li>
    <li><strong>bluetooth</strong>&nbsp;- Low level access to Bluetooth hardware.</li>
    <li><strong>browser</strong>&nbsp;- Enables implementing a browser.</li>
    <li><strong>camera</strong>&nbsp;- Take photos, shoot video and control the camera.</li>
    <li><strong>contacts</strong>&nbsp;- &nbsp;Add, read, or modify contacts from the address book on the device and read contacts from the SIM.&nbsp;<strong>Access property required:</strong>&nbsp;one of&nbsp;<code style="font-size: 14px;">readonly</code>,&nbsp;<code style="font-size: 14px;">readwrite</code>,&nbsp;<code style="font-size: 14px;">readcreate</code>, or&nbsp;<code style="font-size: 14px;">createonly</code>.</li>
    <li><strong>desktop-notification</strong>&nbsp;- Display a notification on the user's desktop.</li>
    <li><strong>device-storage</strong>&nbsp;- Add, read, or modify files stored at a central location on the device.&nbsp;<strong>Access property required:</strong>&nbsp;one of&nbsp;<code style="font-size: 14px;">readonly</code>,&nbsp;<code style="font-size: 14px;">readwrite</code>,&nbsp;<code style="font-size: 14px;">readcreate</code>, or&nbsp;<code style="font-size: 14px;">createonly</code>.</li>
    <li><strong>fmradio</strong>&nbsp;- Control the FM radio.</li>
    <li><strong>geolocation</strong>&nbsp;- Obtain the current location of the user.</li>
    <li><strong>mobileconnection</strong>&nbsp;- Obtain information about the current mobile voice and data connection.</li>
    <li><strong>power</strong>&nbsp;- Turn the screen on or off, control CPU, device power, and so on. Listen for and inspect resource lock events.</li>
    <li><strong>push</strong>&nbsp;- Receive push events.</li>
    <li><strong>settings</strong>&nbsp;- Configure or read device settings.&nbsp;<strong>Access property required:</strong>&nbsp;one of&nbsp;<code style="font-size: 14px;">readonly</code>&nbsp;or&nbsp;<code style="font-size: 14px;">readwrite</code>.</li>
    <li><strong>sms</strong>&nbsp;- Send and receive SMS.</li>
    <li><strong>storage</strong>&nbsp;- Utilize localStorage and indexedDB without size limitations.</li>
    <li><strong>systemclock</strong>&nbsp;- Set current time. (Time zone information is controlled by the settings API.)</li>
    <li><strong>network-http</strong>&nbsp;- Make HTTP requests without any origin restrictions.</li>
    <li><strong>network-tcp</strong>&nbsp;- Create and communicate over TCP sockets.</li>
    <li><strong>telephony</strong>&nbsp;- Access all telephony-related APIs.</li>
    <li><strong>wake-lock-screen</strong>&nbsp;- Turn the display on and show the lock screen.</li>
    <li><strong>webapps-manage</strong>&nbsp;- Obtain access to the&nbsp;<a href="/en-US/docs/Apps/Apps_JavaScript_API#Management_API" title="/en-US/docs/Apps/Apps_JavaScript_API#Management_API">navigator.mozApps.mgmt</a>&nbsp;API to manage installed Open Web Apps.</li>
    <li><strong>wifi</strong>&nbsp;- Enumerate available WiFi networks, get signal strength, connect to a network.</li>
  </ul>
  <h3 id="fullscreen" style="line-height: normal;">fullscreen</h3>
  <p style="line-height: normal;">(Firefox OS only, optional) Set this to <code>true</code> or <code>false</code> to indicate whether the runtime should launch the app in full-screen mode. Example:</p>
  <pre>
"fullscreen": "true"</pre>
  <h3 id="appcache_path" style="line-height: normal;">appcache_path</h3>
  <p style="line-height: normal;">(optional) The absolute path to the application cache (<a href="/en/HTML/Using_the_application_cache" title="https://developer.mozilla.org/en/Offline_resources_in_Firefox">AppCache</a>) manifest.&nbsp; When an Open Web App is installed, the AppCache manifest will be fetched and parsed, and its static assets under the CACHE header will be cached.</p>
  <pre style="font-size: 14px;">
"appcache_path": "/cache.manifest"</pre>
  <h3 id="activities">activities</h3>
  <p>(Firefox OS only, optional) Specifies a set of <a href="/en-US/docs/WebAPI/Web_Activities" title="/en-US/docs/WebAPI/Web_Activities">Web Activities</a> that this app supports. Each property in this field is an activity. Activity names are free-form text, and each activity is represented by an object. Here is an example activities field with one activity named <code>share</code>:</p>
  <pre class="brush: js">
"activities": {
  "share": {
    "filters": {
      "type": [ "image/png", "image/gif" ]
    },
    "href": "foo.html",
    "disposition": "window"
  }
}</pre>
  <p>The object for the <code>share</code> activity in the example has three properties: <code>filters</code>, <code>href</code>, and <code>disposition</code>. These are described below.</p>
  <ul>
    <li><strong>href</strong> -&nbsp;(required) When another app or web page initiates an activity that is supported by this app, if this app is chosen to perform the activity, this specifies the page that will be opened. It will be opened in the manner specified by the <code>disposition</code> property.</li>
    <li><strong>disposition</strong> -&nbsp;(optional) Specifies how the page specified in href is presented when an activity is invoked. The value, if specified, must be one of the following (if omitted, defaults to <code>window</code>):
      <ul>
        <li><strong>window</strong> -&nbsp;The page handling the activity is opened in a new "window" (on a mobile device this view will replace the original app that requested the activity). The page must call <code>navigator.setMessageHandler</code> for each activity it supports and subsequently execute the activity for which it receives a message. Further, if the activity requires a return value, the page must call <code>activity.postResult</code> or <code>activity.postError</code> (where <code>activity</code> is the first argument provided to the function specified by <code>setMessageHandler</code>) as appropriate. These functions are specified in greater detail in <a href="/en-US/docs/WebAPI/Web_Activities" title="/en-US/docs/WebAPI/Web_Activities">Web Activities</a>.</li>
        <li><strong>inline</strong> -&nbsp;The page that handles the activity will open in an overlay (on a mobile device this will be rendered in a popup over the original app that requested the activity). Subsequent behavior is exactly the same as if <code>disposition</code> were <code>window</code>.</li>
      </ul>
    </li>
    <li><strong>filters</strong> -&nbsp;(optional) A dictionary, each property of which specifies a filter. These filters will be applied while determining apps suitable for handling a given activity. Filter names are free-form text, but their values must be either a string or an array of strings (the exact type depends on the filter).</li>
  </ul>
  <h2 id="Path_handling">Path handling</h2>
  <p>All fields that hold paths in the manifest must be absolute paths (for example, <code>/images/myicon.png</code>), and the paths must be served from the same origin as the app.</p>
  <p>Also, there are two ways to set <code>launch_path</code>:</p>
  <ul>
    <li>If your app is stored in the root of a Web server, for example <code>mywebapp.github.com/</code>, then <code>launch_path</code> must be set to <code>/</code>.</li>
    <li>Otherwise, if your app is stored in a subdirectory, for example <code>mymarket.github.com/mywebapp/</code>, then <code>launch_path</code> must be set to <code>/mywebapp/</code>.</li>
  </ul>
  <h2 id="Serving_manifests">Serving manifests</h2>
  <p>The app manifest must be served from the same origin that the app is served from.</p>
  <p>When served from static files, it is recommended that the manifest be stored with a file extension of <code>.webapp</code>.&nbsp; App manifests must be served with a <code>Content-Type</code> header of <code>application/x-web-app-manifest+json</code> (Note: this is currently not enforced by Firefox but is by the Marketplace). Manifests can be served over SSL to mitigate certain classes of attacks.</p>
  <p>The document must be UTF-8 in order for the app to be submitted to Firefox Marketplace. It is recommended to omit the byte order mark (BOM). Other encodings can be specified with a <code>charset</code> parameter on the <code>Content-Type</code> header (i.e. <code>Content-Type: application/x-web-app-manifest+json; charset=ISO-8859-4</code>), though this will not be respected by the Marketplace.</p>
  <p>User Agents when possible should meaningfully message the site identity and TLS status when prompting a user to install an app.</p>
  <h5 id="Serving_from_Apache">Serving from Apache</h5>
  <p>In your .htaccess file, you MUST add the following:</p>
  <pre>
AddType application/x-web-app-manifest+json .webapp</pre>
  <div class="note">
    <strong>Note:</strong> This assumes you're using .webapp as an extension. If you are using .json or another extension, you will have to update the code to reflect that.</div>
  <p>If you don't have a .htaccess file, create it in the root directory of your server. If this doesn't work, your host may require you to also add <code>AddHandler x-web-app-manifest+json .webapp</code>.</p>
  <h5 id="Serving_from_NGINX">Serving from NGINX</h5>
  <p>You need to edit your mime.types file in the conf directory. This will probably be located in either /etc/nginx/ or /opt/nginx/.</p>
  <p>You should have something similar to below. Add in the bold line.</p>
  <pre>
types {
  text/html   html htm shtml;
  text/css    css;
  text/xml    xml;
<strong>  application/x-web-app-manifest+json   webapp;</strong>
}</pre>
  <div class="note">
    <strong>Note:</strong> This assumes you're using .webapp as an extension. If you are using .json or another extension, you will have to update the code to reflect that.</div>
  <h5 id="Serving_from_GitHub">Serving from GitHub</h5>
  <p>If you serve your manifest file from GitHub Pages (<a class="external" href="http://pages.github.com/" title="http://pages.github.com/">http://pages.github.com/</a>), GitHub will serve it with the <code>Content-Type</code> header of <code>application/x-web-app-manifest+json</code>. You must use the <code>.webapp</code> file extension on your manifest file. Example: <code>manifest.webapp</code>.</p>
  <h2 id="Updating_manifests">Updating manifests</h2>
  <p>An app respects the normal rules for Web caching, and may optionally use advanced mechanisms for improved start-up, like the <a class="external" href="http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html#offline">HTML5 AppCache</a>. Given this, there are no special considerations for updating the normal resources that an app uses.</p>
  <p>Open Web Apps are different, however, in the handling of the manifest. Some changes to a manifest may require user approval. Depending on the implementation of the Web runtime, it may be unclear whether an update has occurred.</p>
  <p>As a clean way to deal with this issue, you can provide a <code>version</code> field in the app manifest. You can later check the version by inspecting the return value of the <a href="/en/DOM/Apps.getInstalled" title="en/Apps/Apps_JavaScript_API/navigator.mozApps.getInstalled"><code>navigator.mozApps.getInstalled()</code></a> function. If the user's installed version is not up-to-date, you can trigger an update using <code><a href="/en/DOM/Apps.install" title="https://developer.mozilla.org/en/Apps/Apps_JavaScript_API/navigator.mozApps.install">navigator.mozApps.install()</a>.</code></p>
  <p>The value of <code>version</code> is not used by the Web runtime, so you can use whatever versioning scheme you want.</p>
</div>
<p>Also note that changes to a manifest that introduce errors or other breakage will be detected if the manifest has been submitted to Firefox Marketplace. Serious errors will cause the app's listing to be disabled. Less serious errors may automatically flag the app for re-review.</p>
Revert to this revision