简体   繁体   English

Firefox附加组件:域声明

[英]Firefox add-on: domain declaration

I developed a simple javascript injection which works very well. 我开发了一个简单的javascript注入,效果很好。 Can anybody tell me how to define the domain on which I want my firefox add-on to work for? 谁能告诉我如何定义我要使用Firefox附加组件的域?

Eg this doesn't work for www.myexample.com in main.js: 例如,这对于main.js中的www.myexample.com不起作用:

const self = require("self"),
page_mod = require("page-mod");

exports.main = function() {
    page_mod.PageMod({
        include: "*myexample.com*",
        contentScriptWhen: "ready",
        contentScriptFile: self.data.url("inject.js")
    });
};

These lines also don't work: 这些行也不起作用:

include: "*.myexample.com/*",
include: "*.myexample.com*",

It's all in the documentation : 全部在文档中

include: "*.example.com",

The match-pattern module recognizes when you intend to match the domain name only, no need to add wildcards after the domain name. match-pattern模块仅在您打算匹配域名时才识别,而无需在域名后添加通配符。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM