url_handlers

Published on Updated on

Caution

Important: Chrome will be removing support for Chrome Apps on all platforms. Chrome browser and the Chrome Web Store will continue to support extensions. Read the announcement and learn more about migrating your app.

Used by packaged apps to specify URL patterns the app wants to intercept and handle. An app can define multiple URL handlers under this manifest entry, each having an identifier, a URL pattern, and a title. Here's an example of how to specify url_handlers:

"url_handlers": {
"view_foo_presentation": {
"matches": [
"https://www.foo.com/presentation/view/*"
],
"title": "View Foo presentation"
},
"view_bar_presentation": {
"matches": [
"https://www.bar.com/view/slideshow/*"
],
"title": "View bar presentation"
},
"edit_spreadsheet": {
"matches": [
"https://www.foo.com/spreadsheet/edit/*",
"https://www.bar.com/spreadsheet/edit/*"
],
"title": "Edit spreadsheet"
}
}

Apps can only register to handle URL patterns within domains that they own, that is, can prove ownership of as determined by the Chrome Web Store. Apps that violate this requirement and attempt to register for handling external URLs will be rejected by the Chrome Web Store on upload.

This automatically means that at least a complete domain should always be specified for all the patterns under matches. Otherwise, ownership cannot be verified.

Upon successful registration and installation, an app will be launched for all matching navigations inside browser tabs as well as other apps. The app will receive a new kind of the app.runtime.onLaunched event, with the launchData object containing the matched handler's identifier (such as "view_foo_presentation" above), the URL being navigated to, and the referrer's URL.

The title field is reserved for future use in all relevant UI elements. It should describe the action that the app performs when launched with this type of URL handler.

Updated on Improve article

This site uses cookies to deliver and enhance the quality of its services and to analyze traffic. If you agree, cookies are also used to serve advertising and to personalize the content and advertisements that you see. Learn more about our use of cookies.