Adding "Extension Updated" screen to my Firefox extensions

Hi, everyone!

It’s certainly been a while since I was last on here. Crazy times, huh?

Since the last time I was on here, I’ve created three extensions. Two are available on the Firefox add-ons store, and one is under review. Special thanks to @andreip for helping me with my first one, which eventually led to the other two.

Now, I’m not creating a new topic just to say that. I’ve got to have a real reason to be asking this, right?

I want to add a custom action for when the extension is updated, such as showing a little “Extension Updated” window, or linking to an “Extension Updated” website. How do I do this?

Thanks!

jeremynwest
JWBrowserAddons Official Website
Firefox Add-ons by JWBrowserAddons

1 Like

Read the extension version in your background script with browser.runtime.getManifest().version;

Store the version in local storage. If a version is already in local storage but it’s different, it was an update and open a page.

browser.tabs.create({ url: /pages/update.html?version=${extensionVersion}})@

I think some users are annoyed by new tabs opening after an extension update. That’s not to say you should never do it, but I would reserve opening a tab for when there is critical information that users MUST READ rather than routine information that you could show when a user interacts with your extension’s toolbar button.

1 Like

So how about if it opens a little notification that shows up by the icon that says, “Extension Updated” and provide some release notes?

Thanks for the link! It totally helps! I’m just wondering where to enter the URL or how to make a little notification.

@andreip Do you have a profile on the Firefox Add-ons store? If so, what is your profile URL? If you make extensions, I’d like to check them out.

I also want to add you as a contributor to my Web Tools extension. You helped a lot with its development and I don’t think it’s right to not say you helped.

Thanks again for starting me off on my path of Firefox extension development!

Oh never mind. I found it.

1 Like

I am confused about where exactly I put the code for onboarding, upboarding, and offloading. Does this go in the manifest.json, background.js, or do I create a new file to run the onboarding, upboarding, and offloading code?

Thanks,
jeremynwest

Background js executes once on:
install
browser startup
extension update.

for uninstall check this out https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/setUninstallURL

I see browser.runtime has varous methods for install, update etc. I never used them but you might want to take a look at

I can give you my xIFr as an example.
The source is here: https://github.com/StigNygaard/xIFr/tree/master/WebExtension

I hope that helps?

Here are 2 extensions: one asks for all permissions and logs all events so that you can understand how to hook your code in the extension API. The other allows you to look at the source code of an extension in AMO or chrome web store. If you see an extension with an uninstall flow, you can take a look at the source code.

https://addons.mozilla.org/en-US/firefox/collections/12325762/FF-Extension-Dev-Tools/

If I use the code from your extension, do I have to put that in the source code? What exactly do I do for source code?

No, I think the code handling on/upboarding is very generic (and very inspired by examples online by Mozilla). So I do not see any need to add special licensing or refer back to me in the code. Just go ahead :slight_smile:

Also, can I just tell it to go to a URL, such as a URL on my website?

I actually don’t know. But I think you could argue there could be security and privacy issues by doing that.

I have an introduction page to my extension on my website, but I don’t open it directly in the “onboarding”. In the onboarding I open a page internally in the extension, but it has a link to my introduction page so people have the option to continue to that. In my opinion it is better to do it that way than to open an external page directly without consent from the user.