0

我有一个 chrome 扩展,其代码行如下:

chrome.tabs.executeScript(null, {allFrames:true, file:"myscript.js"});

和功能,如:

chrome.extension.onRequest.addListener

chrome.extension.sendRequest

如何使这些功能适用于 Firefox 扩展?

另外,如何实现选项(弹出)页面和背景页面之间的通信等相同功能?

4

1 回答 1

-1

https://addons.mozilla.org/en-US/developers/docs/sdk/1.14/dev-guide/tutorials/modifying-web-pages-url.html

// Import the page-mod API
var pageMod = require("sdk/page-mod");
// Import the self API
var self = require("sdk/self");

// Create a page mod
// It will run a script whenever a ".org" URL is loaded
// The script replaces the page contents with a message
pageMod.PageMod({
  include: "*.org",
  contentScriptFile: self.data.url("my-script.js")
});
于 2013-05-15T11:18:08.253 回答