它只包含两个文件:
的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>
和resources / main.js:
var pageMod = require("sdk/page-mod");
pageMod.PageMod({
include: "*.gov",
contentScript: 'document.body.innerHTML = ' +
' "<h1>Page matches ruleset</h1>";'
});
它在扩展管理器中安装并显示。没有错误消息,但它也不起作用。 (我不知道,是否有一个特殊的控制台用于插件错误?)。该脚本应该用我的测试替换* .gov站点上的任何内容。这是我想要开始学习firefox插件的最简单的例子,我无法超越这一步。