[英]Firefox extension: apply content_scripts on all web pages but css on specific web page?
I have a Firefox extension where I want to apply contentScript.js
to all web pages .我有一个Firefox扩展,我想在其中将contentScript.js
应用于所有 web 页面。 The manifest.json
looks like this: manifest.json
json 如下所示:
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*"],
"css": ["background.css"],
"js":["contentScript.js"]
}
]
However, I only want the CSS to be applied to a certain web page.但是,我只想将CSS应用于某个web页面。 Right now the CSS is applied to all web pages.现在 CSS 应用于所有 web 页面。
How can I solve this?我该如何解决这个问题?
My friend came up with a solution, change your manifest file to this:我的朋友想出了一个解决方案,将您的清单文件更改为:
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*"],
"js":["contentScript.js"]
},
{
"matches": ["*://*.website.org/*"],
"css": ["background.css"]
}
]
Life saver.救生员。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.