url_handlers

封装应用用于指定应用要拦截和处理的网址格式。应用可以 在此清单条目下定义多个网址处理程序,每个 和标题。以下示例展示了如何指定 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"
  }
}

应用只能进行注册以处理其拥有的网域中的网址格式,也就是说,可以证明 Chrome 应用商店所确定的所有权。应用违反这项要求 尝试注册处理外部网址的行为在上传时会被 Chrome 应用商店拒绝。

也就是说,至少应始终为 matches 下的格式。否则,系统将无法验证所有权。

成功注册和安装后,将针对所有匹配的导航启动应用 以及访问其他应用。该应用将收到一种新的 app.runtime.onLaunched 事件,其 launchData 对象包含匹配处理程序的 标识符(例如上面的“view_foo_presentation”)、要导航到的网址以及引荐来源网址的 网址。

title 字段已预留,供日后在所有相关界面元素中使用。它应说明 应用使用此类网址处理程序启动时执行的操作。