Browser Interface
Important: this package is in early development. It is not ready for production! Do not use it.
WebExtensions allows people to develop browser extensions for multiple browsers. Unfortunately, the methods and syntaxes are not exactly the same in every browser, so that requires some tweaking. This package aims to solve this problem by providing a single syntax for all browsers. It uses the methods and syntax described on the MDN website, and it is compatible with Google Chrome and Mozilla Firefox. Not tested yet in Microsoft Edge.
Installation
Using npm:
npm install --save browser-interface
In Node.js:
; // Create a driver and pass it the window Objectconst driver = window; // Use it in all browsersdriverwebRequestonBeforeRequest;
API coverage
This project is still in progress. Here are the different WebExtensions APIs supported at this time.
webRequest
Property | Status | Chrome | Firefox | Edge |
---|---|---|---|---|
onBeforeRedirect | Complete | ❔ | ❔ | ❔ |
onBeforeRequest | Complete | ✔️ | ✔️ | ❔ |
onBeforeSendHeaders | Complete | ✔️ | ✔️ | ❔ |
onCompleted | Complete | ✔️ | ✔️ | ❔ |
onErrorOccurred | Complete | ❔ | ❔ | ❔ |
onHeadersReceived | Complete | ✔️ | ✔️ | ❔ |
onResponseStarted | Complete | ✔️ | ✔️ | ❔ |
onSendHeaders | Complete | ✔️ | ✔️ | ❔ |
tabs
Property | Status | Chrome | Firefox | Edge |
---|---|---|---|---|
onActivated | Complete | ✔️ | ✔️ | ❔ |
onAttached | Complete | ✔️ | ✔️ | ❔ |
onCreated | Complete | ✔️ | ✔️ | ❔ |
onDetached | Complete | ✔️ | ✔️ | ❔ |
onHighlighted | Complete | ✔️ | ✔️ | ✖️ |
onMoved | Complete | ✔️ | ✔️ | ✖️ |
onRemoved | Complete | ✔️ | ✔️ | ❔ |
onUpdated | Complete | ✔️ | ✔️ | ❔ |
sendMessage | Complete | ❔ | ❔ | ❔ |
query | Complete | ✔️ | ❔ | ❔ |
create | Complete | ❔ | ❔ | ❔ |
remove | Complete | ❔ | ❔ | ❔ |
update | Complete | ❔ | ❔ | ❔ |
get | Complete | ❔ | ❔ | ❔ |
getCurrent | Complete | ❔ | ❔ | ❔ |
storage
Property | Status | Chrome | Firefox | Edge |
---|---|---|---|---|
sync | Complete | ✔️ | ❔ | ❔ |
local | Complete | ✔️ | ❔ | ❔ |
browserAction
Property | Status | Chrome | Firefox | Edge |
---|---|---|---|---|
enable | Complete | ❔ | ❔ | ❔ |
disable | Complete | ❔ | ❔ | ❔ |
setIcon | Complete | ✔️ | ❔ | ❔ |
setPopup | Complete | ❔ | ❔ | ❔ |
setTitle | Complete | ❔ | ❔ | ❔ |
runtime
Property | Status | Chrome | Firefox | Edge |
---|---|---|---|---|
getBackgroundPage | Complete | ✔️ | ❔ | ❔ |
onMessage | Complete | ✔️ | ❔ | ❔ |
sendMessage | Complete | ✔️ | ❔ | ❔ |