Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox / Chrome / MS Edge extensions using chrome.* or browser.*

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.

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)

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.*)?

like image 213
Knight Yoshi Avatar asked Feb 06 '23 15:02

Knight Yoshi


1 Answers

Chrome only has chrome.apis. Edge only has browser.apis. Firefox has both browser.apis and chrome.apis for compatibility with existing Chrome extensions.

The main difference is that in Firefox the browser.apis use promises but the chrome.apis use callbacks.

like image 109
Daniel Herr Avatar answered Feb 16 '23 02:02

Daniel Herr