Files
webextensions-examples/apply-css
Aad Versteden b1b896627a Add doc that received url parameter must be a valid URL
The `new URL(url)` statement will throw an error if the supplied
string is not a valid URL.  Adding a note to the function to clarify
that as requested by @Rob--W.
2020-12-31 13:31:56 +01:00
..

apply-css

This add-on injects CSS into web pages. The addons.mozilla.org domain disallows this operation, so this add-on will not work properly when it's run on pages in the addons.mozilla.org domain.

What it does

This extension includes:

  • a background script, "background.js"
  • a page action

It adds the page action to every tab the user opens. Clicking the page action for a tab applies some CSS using tabs.insertCSS.

Clicking again removes the CSS using tabs.removeCSS.

What it shows

  • some basic page action functions
  • how to apply and remove CSS.