I know I can add the
minimum_chrome_version property to my manifest file to require at least this version of chrome
But what I am looking for is to allow installation of my extension on any chrome version but then from the background page or from my options page check the version of the chrome browser version and based on than either enable or disable some features of my extension that depend on certain minumim version.
Surprisingly I was not able to find a way to do this, even googling for this did not help.
Does anyone know how to check the version of client's chrome browser that my extension is running on?
You can extract get the current Chrome version from the user agent string:
var chromeVersion = /Chrome\/([0-9.]+)/.exec(navigator.userAgent)[1];
When using this to "detect" features, keep in mind the availability of some features vary between channels. In particular, many new features are already available on beta channels, but not on the stable channel, even though releases on both channels have the same version string. Instead of using the version to disable features, you can detect the presence of the APIs, e.g.:
if (chrome.declarativeWebRequest) {
// Use declarativeWebRequest API...
} else {
// fall back to webRequest API...
}
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