Returns information about the browser in which the extension is installed.
This is an asynchronous function that returns a Promise
.
Returns information about the browser in which the extension is installed.
This is an asynchronous function that returns a Promise
.
let gettingInfo = browser.runtime.getBrowserInfo()
None.
A Promise
that will be fulfilled with an object which has the following properties:
name
string value representing the browser name, for example "Firefox".
vendor
string value representing the browser's vendor, for example "Mozilla".
version
string representing the browser's version, for example "51.0" or "51.0a2".
buildID
string representing the specific build of the browser, for example "20161018004015".
Get and log the browser's name:
function gotBrowserInfo(info) {
console.log(info.name);
}
let gettingInfo = browser.runtime.getBrowserInfo();
gettingInfo.then(gotBrowserInfo);
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
getBrowserInfo |
No | No | 51 | ? | No | No | ? | ? | 51 | ? | No | ? |
Note: Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/getBrowserInfo