rsk82
rsk82

Reputation: 29397

my very simple firefox addon doesn't work, what I do wrong here?

It contains only two files:

install.rdf:

<?xml version="1.0" encoding="utf-8"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
  <Description about="urn:mozilla:install-manifest">
    <em:id>my_firefox_ext@localhost</em:id>
    <em:version>0.1</em:version>
    <em:type>2</em:type>
    <em:unpack>false</em:unpack>

    <!-- Firefox -->
    <em:targetApplication>
      <Description>
        <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
        <em:minVersion>21.0</em:minVersion>
        <em:maxVersion>25.0a1</em:maxVersion>
      </Description>
    </em:targetApplication>

    <!-- Front End MetaData -->
    <em:name>my_firefox_ext</em:name>
    <em:creator></em:creator>
  </Description>
</RDF>

and resources/main.js:

var pageMod = require("sdk/page-mod");

pageMod.PageMod({
  include: "*.gov",
  contentScript: 'document.body.innerHTML = ' +
                 ' "<h1>Page matches ruleset</h1>";'
});

It installs and shows in extension manager. There is no error message, but it doesn't work also. ( I don't know, is there a special console for addons errors?). The script should replace any content on *.gov sites with my test. This is simplest example I thought of to start learning firefox addons and I can't manage to go beyond this step.

Upvotes: 1

Views: 79

Answers (1)

paa
paa

Reputation: 5054

You should install the Addon SDK and use the accompanying cfx tool.

Upvotes: 2

Related Questions