[英]How to make content scripts match new tabs in firefox addons/extensions?
I know normally you just set the URL next to matches like - "matches": ["<all_urls>"],
but I could not find any documentation of what the URL is for new tabs in firefox, I could only find that URL for chrome.我知道通常你只是将 URL 设置在匹配旁边,比如 - "matches": ["<all_urls>"],
但我找不到任何关于 URL 用于 firefox 中新标签的文档,我只能找到 URL 用于铬合金。
Heres my manifest.json -这是我的 manifest.json -
{
"manifest_version": 2,
"name": "TestExt1",
"version": "1.0",
"icons": {
"48": "icons/icon1.png"
},
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["TestExt1.js"]
}
]
}
I read another post on here about making a button opening a new tab using "_blank", so I tried setting my matches to "matches": ["_blank"],
in the manifest file but that did not work.我在这里阅读了另一篇关于使用“_blank”制作按钮打开新选项卡的帖子,所以我尝试在清单文件中将我的匹配项设置为"matches": ["_blank"],
但这没有用。 I have confirmed my issue is not with the javascript file because it works on every other URL.我已经确认我的问题不在于 javascript 文件,因为它适用于所有其他 URL。
How can I set my scripts to only make changes to new tabs?如何将我的脚本设置为仅对新选项卡进行更改?
Or is this something I have to make happen within the content script files themselves?或者这是我必须在内容脚本文件中发生的事情吗?
the default new tab page with the tiles is about:newtab
带有图块的默认新标签页是about:newtab
the default home page is about:home
默认主页是about:home
for a blank page use about:blank
对于空白页使用about:blank
See the about:about
page for available about pages.查看about:about
页面以获取可用的 about 页面。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.