chrome 扩展上的 browserAction,用于在网页上嵌入内容(如 Rapportive)

browserAction on chrome extension to embed content on web page (like Rapportive)

我想构建一个 Chrome 扩展,在显示特定网站时显示一些嵌入的内容。与 Gmail 上的 Rapportive 完全相同。

似乎 browserAction 只能让我将该内容显示为弹出窗口,而不是嵌入到网页中。我该怎么做?

如何将其限制为单个 URL?

  1. 要在网页上嵌入内容,请参阅Content Scripts for more details. You could declare your customized scripts/css into current page or use Programming injection 以包含它们
  2. 将其限制为单个 URL,
    • 您可以通过为内容脚本指定 matches 字段来实现
    • 或者如果你想动态注入你的脚本,你可以通过检测当前标签来决定是否注入url。要检测 url,有很多方法可以实现,例如,在 chrome.tabs.onUpdated
    • 的处理程序中检查它