Skip to content

fregante/webext-tools

Repository files navigation

webext-tools npm version

Utility functions for Web Extensions

  • Browsers: Chrome, Firefox, and Safari
  • Manifest: v3

Sponsored by PixieBrix 🎉

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 URL object 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 eval function that throws proper errors.
  • addOptionsContextMenu was 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

About

Utility functions for WebExtensions

Resources

License

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

 
 
 

Contributors