Is there a way for a Chrome extension to read properties from manifest.json
? I'd like to be able to read the version number and use it in the extension.
First check if manifest. json is applied in the browser. For that open developer window by pressing shortcut F12. In Application tab, click Manifest option and see if it displays information that you have set.
One to four dot-separated integers identifying the version of this extension. A couple of rules apply to the integers: they must be between 0 and 65535, inclusive, and non-zero integers can't start with 0. For example, 99999 and 032 are both invalid.
The manifest. json file contains information that defines the extension. The format of the information in the file is JSON. You can read more about what it contains in Google Chrome developer documentation: Manifest File Format. You will probably also want to read: Overview of Google Chrome Extensions.
You can just use chrome. runtime. getManifest() to access the manifest data - you don't need to GET it and parse it.
You can just use chrome.runtime.getManifest()
to access the manifest data - you don't need to GET it and parse it.
var manifestData = chrome.runtime.getManifest(); console.log(manifestData.version); console.log(manifestData.default_locale);
The snipet chrome.app.getDetails()
is not working anymore, is returning an error:
TypeError: Object # has no method 'getDetails'
You want to use chrome.runtime.getManifest()
instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With