|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | + <head> |
| 4 | + <title>Web Application Manifest Format and Management APIs</title> |
| 5 | + <meta http-equiv='Content-Type' content='text/html;charset=utf-8'/> |
| 6 | + <script src='http://dev.w3.org/2009/dap/ReSpec.js/js/respec.js' class='remove'></script> |
| 7 | + <script class='remove'> |
| 8 | + var respecConfig = { |
| 9 | + // document info |
| 10 | + subtitle: "A format for describing web applications and APIs to install, launch and manage them", |
| 11 | + specStatus: "unofficial", |
| 12 | + shortName: "webapps-manifest-api", |
| 13 | + copyrightStart: "2012", |
| 14 | + previousPublishDate: "2012-03-19", |
| 15 | + previousMaturity: "unofficial", |
| 16 | + // lcEnd: ... |
| 17 | + extraCSS: ["http://dev.w3.org/2009/dap/ReSpec.js/css/respec.css"], |
| 18 | + inlineCSS: true, |
| 19 | + // editors |
| 20 | + editors: [ |
| 21 | + { name: "Apps Team", url: "http://mozilla.org/apps/", |
| 22 | + company: "Mozilla", companyURL: "http://mozilla.org/" } |
| 23 | + ], |
| 24 | + // WG |
| 25 | + wg: "Webapps Working Group", |
| 26 | + wgURI: "http://www.w3.org/2008/webapps/", |
| 27 | + wgPublicList: "public-webapps", |
| 28 | + wgPatentURI: "http://www.w3.org/2004/01/pp-impl/42538/status", |
| 29 | + }; |
| 30 | + |
| 31 | + function hilight(r, content) { |
| 32 | + return '<em>' +content+ '</em>' ; |
| 33 | + } |
| 34 | + |
| 35 | + function fixSchema(r, content) { |
| 36 | + return r._esc(content); |
| 37 | + } |
| 38 | + </script> |
| 39 | + </head> |
| 40 | + <body> |
| 41 | + <section id='abstract'> |
| 42 | + This document specifies a JSON based format to describe installable web applications. In addition, |
| 43 | + a set of JavaScript APIs are described that allow web content to trigger installation of such |
| 44 | + applications, as well as manage them on behalf of the user. |
| 45 | + </section> |
| 46 | + |
| 47 | + <section> |
| 48 | + <h2>App Manifest</h2> |
| 49 | + <p> |
| 50 | + An application <dfn>manifest</dfn> is a JSON file describing an installable web application. |
| 51 | + This JSON file consists of a top-level object and several properties. |
| 52 | + </p> |
| 53 | + |
| 54 | + <section> |
| 55 | + <h2>Example</h2> |
| 56 | + <p><pre> |
| 57 | + { |
| 58 | + "name": "MozillaBall", |
| 59 | + "description": "Exciting Open Web development action!", |
| 60 | + "launch_path": "/", |
| 61 | + "version": "1.0", |
| 62 | + "icons": { |
| 63 | + "16": "/img/icon_16.png", |
| 64 | + "48": "/img/icon_48.png", |
| 65 | + "128": "/img/icon_128.png" |
| 66 | + }, |
| 67 | + "developer": { |
| 68 | + "name": "Mozilla", |
| 69 | + "url": "https://mozilla.org/en-US" |
| 70 | + }, |
| 71 | + "installs_allowed_from": [ |
| 72 | + "https://marketplace.mozilla.org" |
| 73 | + ], |
| 74 | + "locales": [ |
| 75 | + "es": { |
| 76 | + "description": "¡Acción abierta emocionante del desarrollo del Web!", |
| 77 | + "developer": { |
| 78 | + "url": "https://mozilla.org/es-ES" |
| 79 | + } |
| 80 | + } |
| 81 | + ], |
| 82 | + "default_locale": "en", |
| 83 | + "screen_size": { |
| 84 | + "min_width": "600", |
| 85 | + "min_height": "300" |
| 86 | + }, |
| 87 | + "required_features": [ |
| 88 | + "touch", "geolocation", "webgl" |
| 89 | + ], |
| 90 | + "orientation": "landscape", |
| 91 | + "fullscreen": "true" |
| 92 | + } |
| 93 | + </pre></p> |
| 94 | + </section> |
| 95 | + |
| 96 | + <section> |
| 97 | + <h2>Properties</h2> |
| 98 | + |
| 99 | + <h3>Mandatory Properties</h3> |
| 100 | + <ul> |
| 101 | + <li><dfn>name</dfn>: |
| 102 | + The name of the web application in the default locale. |
| 103 | + Maximum length is 128 characters. |
| 104 | + </li> |
| 105 | + <li><dfn>description</dfn>: |
| 106 | + A short description of the web application in the default locale. |
| 107 | + Maximum length is 1024 characters. |
| 108 | + </li> |
| 109 | + <li><dfn>default_locale</dfn>: |
| 110 | + [Mandatory only if "locales" property is set]. The locale of the |
| 111 | + top-level name and description. |
| 112 | + </li> |
| 113 | + </ul> |
| 114 | + |
| 115 | + <h3>Optional Properties</h3> |
| 116 | + <ul> |
| 117 | + <li><dfn>launch_path</dfn>: |
| 118 | + The path within the web application's origin that is loaded |
| 119 | + when the application is launched |
| 120 | + </li> |
| 121 | + <li><dfn>icons</dfn>: |
| 122 | + A map of icon sizes to URIs of the icons (which may be absolute or data URIs). |
| 123 | + Icons MUST be square. |
| 124 | + </li> |
| 125 | + <li><dfn>developer</dfn>: |
| 126 | + Information about the developer of the application, suitable for display. |
| 127 | + <ul> |
| 128 | + <li><dfn>name</dfn>: The name of the developer.</li> |
| 129 | + <li><dfn>url</dfn>: A URL pointing to the developer's website</li> |
| 130 | + </ul> |
| 131 | + </li> |
| 132 | + <li><dfn>locales</dfn>: |
| 133 | + A map of locale specific overrides of data contained in the manifest. Each |
| 134 | + locale key is keyed on a locale tag [RFC4646], and contains a sparse |
| 135 | + representation of the manifest. Any field in the <a>locales</a> property |
| 136 | + will override the corresponding property in the manifest. The <a>locales</a>, |
| 137 | + <a>installs_allowed_from</a>, and <a>default_locale</a> CANNOT be overridden. |
| 138 | + If the <a>locales</a> property is set, the <a>default_locale</a> MUST also be |
| 139 | + set. |
| 140 | + </li> |
| 141 | + <li><dfn>installs_allowed_from</dfn>: |
| 142 | + An array of origins that are allowed to trigger installation of this application. |
| 143 | + This field allows the developer to restrict installation of their application to |
| 144 | + specific sites. If the value is omitted, installs are allowed from any site. |
| 145 | + </li> |
| 146 | + <li><dfn>version</dfn>: |
| 147 | + A string that represents the version of this manifest. The User-Agent does |
| 148 | + not interpret this value in any way and is opqaue to everyone but the |
| 149 | + application itself. The field is provided to help the developer deal |
| 150 | + with various update cases, which will be discussed in following sections. |
| 151 | + </li> |
| 152 | + <li><dfn>screen_size</dfn>: |
| 153 | + This object may contain the <code>min_height</code> and <code>min_width</code> |
| 154 | + properties that describe the minimum height and width (in pixels) the application |
| 155 | + needs in order to render correctly. Interpretation of these values is left up |
| 156 | + to the runtime and/or app store. |
| 157 | + </li> |
| 158 | + <li><dfn>required_features</dfn>: |
| 159 | + This array consists of a set of values that describes the mandatory features the |
| 160 | + application needs in order to run correctly. A full list of valid values is TBD. |
| 161 | + </li> |
| 162 | + <li><dfn>orientation</dfn>: |
| 163 | + This value defines the orientation at which the application will initially start. |
| 164 | + Can be one of "portrait", "landscape", "portrait-secondary" or "landscape-secondary". |
| 165 | + The options suffixed with "-secondary" imply a 180 degree rotation from the options |
| 166 | + without the suffix, for instance, holding the phone upside down (but |
| 167 | + still in a manner where width < height), implies the "portrait-secondary" |
| 168 | + orientation. If this field had a valid value, the runtime will not change the orientation |
| 169 | + of the view rendering the application even if the device is turned. |
| 170 | + </li> |
| 171 | + <li><dfn>fullscreen</dfn>: |
| 172 | + This value is set to "true" or "false" to describe whether the runtime should |
| 173 | + launch the application in fullscreen mode. |
| 174 | + </li> |
| 175 | + </ul> |
| 176 | + </section> |
| 177 | + |
| 178 | + <section> |
| 179 | + <h2>Serving Manifests</h2> |
| 180 | + <p> |
| 181 | + An application manifest MUST be served from the same origin that the application |
| 182 | + itself is served from. There MUST only be one application per origin. |
| 183 | + </p> |
| 184 | + <p> |
| 185 | + When served as a static file, it is RECOMMENDED that the manifest be stored |
| 186 | + with the extension <code>.webapp</code>. The manifest MUST be served with a |
| 187 | + <code>Content-Type</code> header of <code>application/x-web-app-manifest+json</code>. |
| 188 | + It is RECOMMENDED that manifests be served over SSL. |
| 189 | + </p> |
| 190 | + </section> |
| 191 | + </section> |
| 192 | + |
| 193 | + <section> |
| 194 | + <h2>Application Records</h2> |
| 195 | + <section> |
| 196 | + <p> |
| 197 | + Applications are represented by a JavaScript object that is accessible to web content. |
| 198 | + </p> |
| 199 | + <dl title='interface AppObject' class='idl'> |
| 200 | + <dt>readonly attribute DOMString origin</dt> |
| 201 | + <dd> |
| 202 | + The origin of the application, represented by a FQDN. |
| 203 | + </dd> |
| 204 | + <dt>readonly attribute Object manifest</dt> |
| 205 | + <dd> |
| 206 | + A JavaScript object as returned by JSON.parse invoked on the manifest. |
| 207 | + </dd> |
| 208 | + <dt>readonly attribute DOMString installOrigin</dt> |
| 209 | + <dd> |
| 210 | + The origin of the page from which the application was installed. |
| 211 | + </dd> |
| 212 | + <dt>readonly attribute unsigned long installTime</dt> |
| 213 | + <dd> |
| 214 | + Time in milliseconds since epoch at which the application was installed. |
| 215 | + </dd> |
| 216 | + <dt>readonly attribute Object parameters</dt> |
| 217 | + <dd> |
| 218 | + Parameters that were provided at install time. |
| 219 | + </dd> |
| 220 | + <dt>EventTarget launch()</dt> |
| 221 | + <dd> |
| 222 | + Launches this application (behaviour is runtime dependent). |
| 223 | + </dd> |
| 224 | + <dt>EventTarget uninstall()</dt> |
| 225 | + <dd> |
| 226 | + Uninstalls this application. <em>This call is available to privileged callers only.</em> |
| 227 | + </dd> |
| 228 | + </dl> |
| 229 | + </section> |
| 230 | + </section> |
| 231 | + <section> |
| 232 | + <h2>Application Registry</h2> |
| 233 | + <section> |
| 234 | + <p> |
| 235 | + A privileged caller is a web page that has been explicitely authorized by the user to manage |
| 236 | + applications on their behalf. Such privileged origins also have access to the AppRegistry |
| 237 | + interface as described below. |
| 238 | + </p> |
| 239 | + <dl title='interface AppRegistry : Navigator' class='idl'> |
| 240 | + <dt>EventTarget install(in DOMString manifestUrl, [Optional] in Object parameters)</dt> |
| 241 | + <dd> |
| 242 | + Triggers the installation of an application as specified by the manifest at |
| 243 | + <code>manifestUrl</code>. The User-Agent must fetch the manifest from the provided |
| 244 | + URL, verify that it is valid, and then ask for permission from the user to allow |
| 245 | + installation to proceed. The User-Agent must also persist the parameters provided |
| 246 | + (if any) which may later be retrived from the <code>AppObject</code> representing |
| 247 | + this application. The user may choose to whitelist certain origins to allow them |
| 248 | + to install applications without any permission prompts. |
| 249 | + </dd> |
| 250 | + <dt>EventTarget getSelf()</dt> |
| 251 | + <dd> |
| 252 | + Retrieves the application record for the origin from which the call is made. |
| 253 | + </dd> |
| 254 | + <dt>EventTarget getInstalled()</dt> |
| 255 | + <dd> |
| 256 | + Retrives application records for all applications that have been installed so far. |
| 257 | + <em>This call is available to privileged callers only.</em> |
| 258 | + </dd> |
| 259 | + <dt>attribute EventListener oninstall</dt> |
| 260 | + <dd> |
| 261 | + This value may be set to a function that will be invoked when an application is |
| 262 | + installed. The only argument to this function will be the <code>AppObject</code> of the |
| 263 | + applicatio that was installed. <em>This attribute can be set by priveleged callers only.</em> |
| 264 | + </dd> |
| 265 | + <dt>attribute EventListener onuninstall</dt> |
| 266 | + <dd> |
| 267 | + This value may be set to a function that will be invoked when an application is |
| 268 | + uninstalled. The only argument to this function be the <code>AppObject</code> of the |
| 269 | + application that was uninstalled. <em>This attribute can be set by privileged callers only.</em> |
| 270 | + </dd> |
| 271 | + </dl> |
| 272 | + </section> |
| 273 | + <h2>Application Events</h2> |
| 274 | + <section> |
| 275 | + <p> |
| 276 | + Most of the methods described above return an <code>EventTarget</code> object to which |
| 277 | + success and error handlers may be attached using standard DOM methods like <code>addEventListener</code> |
| 278 | + or attributes like <code>onsuccess</code> and <code>onerror</code>. |
| 279 | + </p> |
| 280 | + <dl title='interface AppEventError' class='idl'> |
| 281 | + <dt>const unsigned short PERMISSION_DENIED = 1</dt> |
| 282 | + <dd>Installation was denied (by user or UA).</dd> |
| 283 | + <dt>const unsigned short MANIFEST_URL_ERROR = 2</dt> |
| 284 | + <dd>The manifest could not be found at the given location.</dd> |
| 285 | + <dt>const unsigned short NETWORK_ERROR = 4</dt> |
| 286 | + <dd>The manifest could not fetched from the given location at this time.</dd> |
| 287 | + <dt>const unsigned short MANIFEST_PARSE_ERROR = 5</dt> |
| 288 | + <dd>The manifest could not be parsed.</dd> |
| 289 | + <dt>const unsigned short INVALID_MANIFEST = 6</dt> |
| 290 | + <dd>The manifest was able to be parsed but contains invalid values.</dd> |
| 291 | + <dt>readonly attribute short code</dt> |
| 292 | + <dd>This value is set to one of the constants defined in this interface.</dd> |
| 293 | + </dl> |
| 294 | + |
| 295 | + <dl title='interface AppEventTarget : EventTarget' class='idl'> |
| 296 | + <dt>attribute EventListener onsuccess</dt> |
| 297 | + <dd>May be set to a success handler.</dd> |
| 298 | + <dt>attribute EventListener onerror</dt> |
| 299 | + <dd>May be set to an error handler.</dd> |
| 300 | + <dt>void addEventListener(DOMString event, EventListener e)</dt> |
| 301 | + <dd> |
| 302 | + <code>event</code> can be either be "install" or "uninstall". |
| 303 | + </dd> |
| 304 | + <dt>void removeEventListener(DOMString event, EventListener e)</dt> |
| 305 | + <dd> |
| 306 | + <code>event</code> can either be "install" or "uninstall". |
| 307 | + </dd> |
| 308 | + <dt>readonly attribute Object result</dt> |
| 309 | + <dd> |
| 310 | + The type and value of <code>result</code> depends on the operation for which this |
| 311 | + <code>EventTarget</code> was returned. If an <code>onerror</code> is fired, this |
| 312 | + value will be set to <code>AppEventError</code>. When <code>getSelf()</code> and |
| 313 | + <code>getInstalled()</code> succeed, ths value will be set to an array of |
| 314 | + <code>AppObject</code>s. |
| 315 | + </dd> |
| 316 | + </dl> |
| 317 | + </section> |
| 318 | + </section> |
| 319 | + <!-- |
| 320 | + <section> |
| 321 | + <h2>A Good Reference</h2> |
| 322 | + <p> |
| 323 | + One can trivially make references to any specification, say for instance [[WIDGETS]], [[WICD]], |
| 324 | + and even in a normative way [[!REX]] or [[!SVGMOBILE12]]. It's all about I18N, [[ZHMARK]]. |
| 325 | + </p> |
| 326 | + </section> |
| 327 | + |
| 328 | + <section> |
| 329 | + <h2>Russian Turtles</h2> |
| 330 | + <p> |
| 331 | + This section has an <code>h2</code> title in the original source. |
| 332 | + </p> |
| 333 | + <section> |
| 334 | + <h2>Russian Turtles</h2> |
| 335 | + <p> |
| 336 | + This section has an <code>h2</code> title in the original source. |
| 337 | + </p> |
| 338 | + <section> |
| 339 | + <h2>Russian Turtles</h2> |
| 340 | + <p> |
| 341 | + This section has an <code>h2</code> title in the original source. |
| 342 | + </p> |
| 343 | + <section> |
| 344 | + <h2>Russian Turtles</h2> |
| 345 | + <p> |
| 346 | + This section has an <code>h2</code> title in the original source. |
| 347 | + </p> |
| 348 | + <section> |
| 349 | + <h2>Russian Turtles</h2> |
| 350 | + <p> |
| 351 | + This section has an <code>h2</code> title in the original source. |
| 352 | + </p> |
| 353 | + <section> |
| 354 | + <h2>Russian Turtles</h2> |
| 355 | + <p> |
| 356 | + This section has an <code>h2</code> title in the original source. |
| 357 | + </p> |
| 358 | + </section> |
| 359 | + </section> |
| 360 | + </section> |
| 361 | + </section> |
| 362 | + </section> |
| 363 | + </section> |
| 364 | +
|
| 365 | + <section> |
| 366 | + <h2>Transforming content</h2> |
| 367 | + <p>Transforming content is also easy! <span data-transform='hilight'>this text is hilighted by being wrapped in an 'em'</span>.</p> |
| 368 | + </section> |
| 369 | +
|
| 370 | + <section class='appendix'> |
| 371 | + <h2>Acknowledgements</h2> |
| 372 | + <p> |
| 373 | + Many thanks to Marcos Cáceres for moral support, and to Bert Bos and Geoffrey Sneddon for their |
| 374 | + tools from which I pilfered joyfully. |
| 375 | + </p> |
| 376 | + </section>--> |
| 377 | + </body> |
| 378 | +</html> |
0 commit comments