webext-active-tab [](https://www.npmjs.com/package/webext-active-tab)

January 31, 2025 · View on GitHub

WebExtension module: Track activeTab permission; automatically inject content scripts

The main use case is to ship your extension without host_permissions and have the user invoke the extension on click on any website.

Alternatively, consider using webext-permission-toggle and webext-dynamic-content-scripts to permanently receive access to certain hosts and automatically register content scripts on it.

Install

npm install webext-active-tab

Usage

This package exports various utilities, just import what you need.

Note

Firefox has some limitations:

  • activeTab seems to be lost after a reload
  • further contextMenu clicks receive a moz-extension URL rather than the current page’s URL

License

MIT © Federico Brigante