Thomas
Thomas

Reputation: 25

How do I use the version information from manifest

I want to use the version number from the manifest file in my extension. Is there a way to access the value?

Thanks!

Upvotes: 1

Views: 959

Answers (1)

Dmitrii Sorin
Dmitrii Sorin

Reputation: 4016

Currently there are 2 ways to get this. First is to perform XMLHttpRequest to manifest.json (URL is chrome.extension.getURL("manifest.json")) and to JSON.parse the response. Second way is to use chrome.apps.getDetails() API which is gonna change sooner or later

BTW i have found another way to get version of extension. You can use chrome.management to get it. In fact it's more pretty than using chrome.app.getDetails and it's async, but it seems superfluous to use the whole API for just getting version of your own extension.

UPD 2014/05/18: chrome.runtime.getManifest().version is now probably the best way to do this.

Upvotes: 4

Related Questions