I have a firefox web extension ported from chrome. This is a site specific extension and I am hosting this on my web server to avoid lengthy review times on developer hub.
Users install extension through a button click on my web page. Let's say the current version of extension is 3. The button click handler is like this
document.getElementById('install_ext').addEventListener('click', function (e) {
window.location.href = '/public/ffext_3.xpi';
});
When there is a new version of extension built, say version 4, I am deleting the existing ffext_3.xpi file, adding the new ffext_4.xpi file in public folder and modifying the href in js to '/public/ffext_4.xpi' on the server. There is some UI level handling also like show install button if extension not present, show update button if update is available, etc
Everything is working till this point. But there are some mechanical things being done.
I have to modify the href in js file manually.
The user has to update the extension manually whenever the UI prompts.
I tried to use InstallTrigger object but there also, I had to give complete xpi url that has version number in it.
document.getElementById('install_ext').addEventListener('click', function (e) {
var params = {
"MyExtension": {URL: 'https://addons.mozilla.org/firefox/downloads/file/12345/myext-0.1.2-fx.xpi',
IconURL: '/public/exticon.png',
Hash: 'sha1:1234567890abcdefghij1234567890abcdefghij',
toString: function () {
return this.URL;
}
}
};
InstallTrigger.install(params);
});
I am not sure if I have to update this URL whenever I upload a new extension. I am trying to avoid review delays and so, I would not want to use InstallTrigger way unless it is the only way for automatic updating of extension on users' browsers.
Is there a way to update the extension automatically without user intervention? I am thinking that if automatic update is possible, I can avoid changing the file names of xpi and make that href as '/public/ffext.xpi'. Am I right or do I need to keep updating the urls even with automatic update mechanism in place?
applications.gecko.update_url
- this will do. I was not able to find this link on google so asked on SO. Thanks. – Wulfe