DEV Community

Paul
Paul

Posted on

6 1

WeatherTab for Firefox

Remember WeatherTab? It’s a new tab extension that I created for Chrome, and I just released its port to Firefox.

According to Mozilla’s documentation, Firefox is almost completely compatible with the extension API supported by Chrome and Opera (and, by extension (puns!), my favorite underdog Vivaldi). They have a page dedicated to helping developers port their Chrome extensions to Firefox. And they’re not kidding; I had to change almost nothing to get WeatherTab working in Firefox.

The extension uses the geolocation permission, which in JavaScript means using navigator.geolocation. I didn’t have to do anything to get this working.

It also uses the storage permission, which means using chrome.storage. Even though this seems Chrome-specific, Firefox states that in most cases, it will work without any developer intervention. In my case, this turned out to not be true, but not for the reason I thought.

Firefox does support the usage of chrome.storage, but it does not support chrome.storage.sync without an application ID. Changing it to chrome.storage.local allowed the extension to work again, but it meant the temperature setting wouldn’t be synchronized across browsers.

I ended up pushing out the first version of the port with chrome.storage.local, then once the extension was live, I grabbed the UUID from the developer page, updated the manifest with it, updated the code to use chrome.storage.sync, and republishing. Now version 1.4.3 is live with the working synced temp setting. (I bumped the version of the Chrome extension to maintain parity between the two.)

Check out the shiny new extension!
Judge my crazy nested Yahoo API calls on GitHub.

This was originally published on eichefam.net.

SurveyJS custom survey software

Simplify data collection in your JS app with a fully integrated form management platform. Includes support for custom question types, skip logic, integrated CCS editor, PDF export, real-time analytics & more. Integrates with any backend system, giving you full control over your data and no user limits.

Learn more

Top comments (0)

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay