I have a Firefox extension ported with chrome. This is an extension for a particular site, and I host it on my web server to avoid a long browsing time on the developer's site.
Users install the extension via a button on my web page. Let's say the current version of the extension is 3. The button click handler looks like this:
document.getElementById('install_ext').addEventListener('click', function (e) { window.location.href = '/public/ffext_3.xpi'; });
When there is a new version of the built-in extension, say version 4, I delete the existing ffext_3.xpi file by adding the new ffext_4.xpi file to the shared folder and changing the href in js to '/ public / ffext_4. xpi "on the server. There is some user interface level processing, for example, the show install button if there is no extension, show the update button if an update is available, etc.
Everything works up to this point. But there are some mechanical things.
I tried using the InstallTrigger object, but I also had to specify the full xpi url, which has a version number.
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'm not sure if I should update this url whenever I download a new extension. I try to avoid viewing delays, and therefore, I would not want to use the InstallTrigger method, unless this is the only way to automatically update the extension in users browsers.
Is there a way to update the extension automatically without user intervention? I think that if automatic updating is possible, I can avoid changing the xpi file names and make it href like '/public/ffext.xpi'. Am I right, or do I need to constantly update URLs even with an automatic in-place update mechanism?