我可以确定何时将 webextensions firefox 插件安装到页面吗?

Can I determine when to install webextensions firefox addon to a page?

我使用 webextensions 技术编写了一个 firefox 插件。默认情况下,firefox 在页面加载结束时加载插件。但是有些页面加载js很慢,比如一些广告或统计代码,所以如果我停止不必要的页面加载,插件将不会加载。或者等待很长时间才能加载插件。

那么我可以设置插件加载时间吗? (示例:页面加载前)

检查 content_scripts 中的 run_at 选项 manifest options。例如,您可以使用以下选项:

content_scripts": [
  {
    "js": ["my-script.js"],
    "matches": ["https://example.org/"],
    "match_about_blank": true,
    "run_at": "document_start"
  }
]