webext-tools [](https://www.npmjs.com/package/webext-tools)
April 11, 2026 · View on GitHub
Utility functions for Web Extensions
- Browsers: Chrome, Firefox, and Safari
- Manifest: v3
Sponsored by PixieBrix :tada:
Install
npm install webext-tools
Or download the standalone bundle to include in your manifest.json.
Usage
This package exports various utilities. Each tool has its own entry point, so you only import what you need:
import doesTabExist from 'webext-tools/does-tab-exist.js';
import getExtensionUrl from 'webext-tools/get-extension-url.js';
- doesTabExist - Checks whether a tab exists.
- getExtensionUrl - Generates a
URLobject for a resource bundled with the extension. - getTabUrl - Get a tab or frame’s URL even with limited permissions.
- queryTabsByUrl - Get the IDs of tabs matching URL patterns.
- setActionPopup - Sets the popup URL (or removes the popup) depending on the current tab.
- createContextMenu - Creates context menus without pain.
- devToolsEval - Wrapper around the DevTools
evalfunction that throws proper errors. addOptionsContextMenuwas moved to webext-bugs.
Related
- webext-events - High-level events and utilities for events in Web Extensions.
- webext-base-css - Extremely minimal stylesheet/setup for Web Extensions’ options pages (also dark mode)
- webext-options-sync - Helps you manage and autosave your extension's options.
- webext-detect - Detects where the current browser extension code is being run.
- More…
License
MIT © Federico Brigante