What is the best/correct way to get the extension version?
I was using the following, which I found recommended somewhere:
chrome.manifest = (function() {
var manifestObject = false;
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
manifestObject = JSON.parse(xhr.responseText);
}
};
xhr.open("GET", chrome.extension.getURL('/manifest.json'), false);
try {
xhr.send();
} catch(e) {
console.log('Couldn\'t load manifest.json');
}
return manifestObject;
})();
However, this seems to cause an issue in the _generated_background_page_ when using it background,js (with "background": { "scripts": ["background.js"] } in the manifest).
I've changed to the simpler:
var version = chrome.app.getDetails().version;
which seems to work, but I've read that it is (was) buggy?
Cheers,
Nige
But say you have a published app or extension and need to get the
data... it seems that in that use case XHRing the manifest is the best
option.
-C
> --
> You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
> To post to this group, send email to chromium-...@chromium.org.
> To unsubscribe from this group, send email to chromium-extens...@chromium.org.
> For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.
>
--
sig ver 2.4
twitter: @chews (drunk tweet me)
blog: http://spazout.com
iPhone: 310.933.4533