在subtest中验证浏览器类型。
我正在尝试创建一个跨浏览器扩展名,并且遇到了一个小打ic。
>清单_version:3
不支持Firefox上(尽管我可以使用清单V2,v2在Chrome上正常工作,但弹出了警告,该警告将在2023年折旧)。“ browser_specific_settings”
键仅在firefox上起作用并在chrome中抛出错误,因为这是特定于gecko的。
有什么方法可以验证浏览器类型?也许这样的东西:
{
"if": { "browser_type": chrome },
"then": { "manifest_version": 3 },
"else": {
"if": { "browser_type": firefox },
"then": { "manifest_version": 2,
"browser_specific_settings": {
"gecko": {
"id": "[email protected]"
}
}
}
},
"name": "Custom Addon",
"version": "0.1",
"description": "Addon Test",
"incognito": "spanning",
"permissions": ["tabs"],
"chrome_url_overrides": {
"newtab": "test.html"
}
}
I am trying to create a cross-browser extension and I have run into a small hiccup.
manifest_version: 3
isn't supported on firefox (albeit I could used manifest v2 which works fine on chrome but pops up with a warning that it will be depreciated in 2023).The
"browser_specific_settings"
key only works on firefox and throws up an error in chrome as this is gecko specific.
Is there any way I can validate for the browser type? Maybe something like this:
{
"if": { "browser_type": chrome },
"then": { "manifest_version": 3 },
"else": {
"if": { "browser_type": firefox },
"then": { "manifest_version": 2,
"browser_specific_settings": {
"gecko": {
"id": "[email protected]"
}
}
}
},
"name": "Custom Addon",
"version": "0.1",
"description": "Addon Test",
"incognito": "spanning",
"permissions": ["tabs"],
"chrome_url_overrides": {
"newtab": "test.html"
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论