我正在编写一个优惠券样式的 Chrome 扩展,我希望它仅在特定网站(超过 300 个网站)上运行。我读过有关在 content_scripts 中指定网站 url 的内容,但这似乎不实用,尤其是当我需要更新它时。这是我的脚本:
清单.json
{
"name": "Example",
"description": "description",
"version": "1.0",
"manifest_version": 2,
"background":
{
"scripts": ["js/background.js", "js/eventPage.js", "js/jquery-
3.2.1.min.js"],
"persistent":false
},
"page_action": {
"default_icon":"img/32icon.png"
},
"content_scripts": [
{
"matches": ["https://*/*"],
"js": ["js/sites_cs.js", "js/jquery-3.2.1.min.js"]
}
],
"permissions": [
"tabs",
"http://*/*",
"https://*/*",
"activeTab"
]
}
Run Code Online (Sandbox Code Playgroud)