Back to Content

runtime.getVersion()

files/en-us/mozilla/add-ons/webextensions/api/runtime/getversion/index.md

latest910 B
Original Source

Returns the extension's version from the version manifest key.

Syntax

js-nolint
let extensionVersion = await browser.runtime.getVersion()

Parameters

None.

Return value

A string containing the extension's version as declared in the manifest.

[!NOTE] The returned version may differ from the string in the file because the browser can parse and serialize it.

Examples

Get the extension version string:

js
const version = browser.runtime.getVersion();
console.log(version);

{{WebExtExamples}}

Browser compatibility

{{Compat}}

See also

  • The {{WebExtAPIRef("runtime.getManifest()")}} method, which returns the entire manifest as an object.
  • Manifest version key