Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / common / extensions / docs / templates / articles / manifest / url_handlers.html
1 <h1 id="url_handlers">url_handlers</h1>
2
3 <p>
4 Used by <a href="../app_lifecycle.html#eventpage">packaged apps</a>
5 to specify URL patterns the app wants to intercept and handle. An app can
6 define multiple URL handlers under this manifest entry, each having an identifier,
7 a URL pattern, and a title.
8 Here's an example of how to specify <code>url_handlers</code>:
9 </p>
10
11 <pre data-filename="manifest.json">
12 "url_handlers": {
13   "view_foo_presentation": {
14     "matches": [
15       "https://www.foo.com/presentation/view/*"
16     ],
17     "title": "View Foo presentation"
18   },
19   "view_bar_presentation": {
20     "matches": [
21       "https://www.bar.com/view/slideshow/*"
22     ],
23     "title": "View bar presentation"
24   },
25   "edit_spreadsheet": {
26     "matches": [
27       "https://www.foo.com/spreadsheet/edit/*",
28       "https://www.bar.com/spreadsheet/edit/*"
29     ],
30     "title": "Edit spreadsheet"
31   }
32 }</pre>
33
34 <p>
35 Apps can only register to handle URL patterns within domains that they own,
36 that is, can prove ownership of as determined by the
37 <a href="https://chrome.google.com/webstore">Chrome Web Store</a>.
38 Apps that violate this requirement and attempt to register for handling external
39 URLs will be rejected by the Chrome Web Store on upload.
40 </p>
41 <p>
42 This automatically means that at least a complete domain should always be
43 specified for all the patterns under <code>matches</code> (otherwise ownership
44 cannot be verified).
45 </p>
46 <p>
47 Upon successful registration and installation, an app will be launched for all
48 matching navigations inside browser tabs as well as other apps. The app will
49 receive a new kind of the
50 <a href="../app_runtime.html#event-onLaunched">app.runtime.onLaunched</a>
51 event, with the launchData
52 object containing the matched handler's identifier (such as "view_foo_presentation"
53 above), the URL being navigated to, and the referrer's URL.
54 </p>
55 <p>
56 The <code>title</code> field is reserved for future use in all relevant UI elements.
57 It should describe the action that the app performs when launched with this type
58 of URL handler.
59 </p>