Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The equivalent to a content script in a Firefox extension?

I am quite new to Firefox and its extensions. Is there something like a script using JavaScript that runs every time a page loads? My chrome extension injects a css file creating a link tag using js. How do I port this to Firefox?

like image 301
Jacques Blom Avatar asked Feb 28 '12 16:02

Jacques Blom


1 Answers

You want the pageMod API.

var pageMod = require("page-mod");
pageMod.PageMod({
  include: "*.example.org",
  contentScript: 'window.alert("Page matches ruleset");'
});
like image 76
abraham Avatar answered Sep 21 '22 13:09

abraham