Type | String |
---|---|
Mandatory | Yes |
Example |
|
The version string for the extension.
Type | String |
---|---|
Mandatory | Yes |
Example |
|
The version string for the extension.
The version string consists of 1 to 4 numbers separated by dots, for example, 1.2.3.4
. Non-zero numbers must not include a leading zero. For example, 2.01
is not allowed; however, 0.2
, 2.0.1
, and 2.10
are allowed.
Extension stores and browsers may enforce or warn if the version string doesn't comply with this format. They may also apply restrictions to the range of numbers available. For example:
^(0|[1-9][0-9]{0,8})([.](0|[1-9][0-9]{0,8})){0,3}$
. Also, from Firefox 108, a warning is provided if an extension is installed with a version number that doesn't match this format.It may be possible to create an extension that appears to have a valid version number when run in a browser but doesn't comply with store requirements. Particular care should be taken when developing cross-browser extensions that use large number elements.
Some browsers and web stores may recognize the version_name key. This key enables you to provide a descriptive version string that may be displayed instead of the version number. For example, 1.0 beta
.
To determine which of two extension versions is the most recent, the version string numbers are compared left to right. A missing version string element is equivalent to 0
. For example, 1.0 is equivalent to 1.0.0.0. The first version string with a number greater than the corresponding number in the other version string is the most recent. For example, 1.10 is a more recent version than 1.9.
See Legacy version formats for details of previously supported version strings.
You obtain the extension version in your JavaScript code using:
console.log(browser.runtime.getManifest().version);
If the manifest contains:
"version": "0.1"
You see this in the console log:
"0.1"
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
version |
YesValid Chrome versions are a subset of valid Firefox versions. |
14 | 48 | ? | Yes | 14 | ? | ? | 48 | ? | 15 | ? |
© 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/manifest.json/version