Home | History | Annotate | Download | only in manifest
      1 <h1 id="file_handlers">Manifest - File Handlers</h1>
      2 
      3 <p>
      4 Used by <a href="../app_lifecycle#eventpage">packaged apps</a>
      5 to specify what types of files the app can handle. An app can have multiple
      6 <code>file_handlers</code>, with each one having an identifier, a list of MIME
      7 types and/or a list of file extensions that can be handled.
      8 The app can handle a file if it either has a matching file extension or
      9 has a matching MIME type.
     10 You can use a wildcard <code>"*"</code> in <code>types</code> or
     11 <code>extensions</code> to indicate that the app can handle any file type or
     12 <code>"<em>type</em>/*"</code> in <code>types</code> to indicate that the app
     13 can handle any file with a MIME type of <code><em>type</em></code>.
     14 Here's an example of specifying file handlers:
     15 </p>
     16 
     17 <pre data-filename="manifest.json">
     18 "file_handlers": {
     19   "text": {
     20     "types": [
     21       "text/*"
     22     ],
     23     "title": "{Name of app}"
     24   },
     25   "image": {
     26     "types": [
     27       "image/png",
     28       "image/jpeg"
     29     ],
     30     "extensions": [
     31       "tiff"
     32     ],
     33     "title": "{Name of app}"
     34   },
     35   "any": {
     36     "extensions": [
     37       "*"
     38     ],
     39     "title": "{Name of app}"
     40   }
     41 }
     42 </pre>
     43 
     44 <p class="note">
     45 The <code>title</code> attribute is mandatory on Chrome
     46 version 37 and earlier. As of Chrome version 38, it is deprecated and
     47 will be ignored (the app's name will be used instead). For
     48 compatibility, <code>title</code> should always be the name of the app.
     49 </p>
     50 
     51 <p>
     52 To handle files, apps also need to declare the $(ref:fileSystem)
     53 permission. Apps can then be passed files in the $(ref:app.runtime.onLaunched)
     54 event - either from the system
     55 file manager (currently supported on ChromeOS only) or by providing
     56 a path on the <a href="../first_app#open">command line</a>.
     57 </p>
     58