Skip to content

Instantly share code, notes, and snippets.

@urig
Created November 22, 2015 16:22
Show Gist options
  • Save urig/f5aa42946210d1f202d3 to your computer and use it in GitHub Desktop.
Save urig/f5aa42946210d1f202d3 to your computer and use it in GitHub Desktop.
Firefox add-on index.js with elegant hack to load a page-mod script from the add-on's root folder rather than from under its /data folder (for http://stackoverflow.com/questions/22656494/contentscriptfile-dont-work-in-pagemod)
var self = require('sdk/self');
var pageMod = require("sdk/page-mod");
pageMod.PageMod({
include: "*.github.com",
contentScriptFile: "resource://<your_extension_name>/somefile.js"
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment