问题描述
因此,我找不到任何有关使用chrome.*或浏览器.*的内容.在某些WebExtension示例中,它使用浏览器.*(browser.runtime.getManifest();
) https://developer.mozilla.org/zh- US/Add-ons/WebExtensions/API/runtime/getManifest ,在其他情况下则使用chrome.*(chrome.notifications.create
), https://developer.mozilla.org/zh-CN/Add-ons/WebExtensions/API/notifications .
So I couldn't find anything that talked about using chrome.* or browser.* specifically. In some of the WebExtension examples it uses browser.* (browser.runtime.getManifest();
)https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/runtime/getManifest, and in others it uses chrome.* (chrome.notifications.create
), https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/notifications.
我不太确定有什么区别.它是上下文相关的吗?我的内容脚本和Firefox的后台脚本中都可以使用chrome.*和browser.*.我也查看了IEs文档,他们使用了浏览器.*(在他们的文档中没有看到chrome.*)
I'm not entirely sure what's the difference. Is it contextual? Both chrome.* and browser.* are available in my content script and in the background script in Firefox. I looked at IEs docs as well and they use browser.* ( didn't see chrome.* in their docs)
我想知道两者之间的区别,Chrome扩展程序仅使用chrome.*还是具有浏览器.*(IE仅具有浏览器.*)吗?
I'd like to know what the difference is between and do Chrome extensions only use chrome.* or does it have browser.* as well (does IE only have browser.*)?
推荐答案
Chrome仅具有chrome.apis. Edge仅具有browser.apis. Firefox同时具有browser.apis和chrome.apis,以与现有的Chrome扩展程序兼容.
Chrome only has chrome.apis. Edge only has browser.apis. Firefox has both browser.apis and chrome.apis for compatibility with existing Chrome extensions.
主要区别在于,在Firefox中,browser.apis使用promises,而chrome.apis使用回调.
The main difference is that in Firefox the browser.apis use promises but the chrome.apis use callbacks.
这篇关于使用chrome.*或浏览器的Firefox/Chrome/MS Edge扩展.*的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!