HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
mozilla
webextension-polyfill
JavaScript2017–2025
mozilla / webextension-polyfill · Archived

webextension-polyfill

A lightweight polyfill library for Promise-based WebExtension APIs in Chrome

18Distinct people
22Mentions
0Explicit recommenders
3.1KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

A lightweight polyfill library for Promise-based WebExtension APIs in Chrome

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:03:16 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year22 dated mentions

Observed mentions: 2017-08-01 19:24:06 UTC to 2025-06-22 14:02:41 UTC.

012342017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments20172018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 4 mentions; 1 submissions, 3 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments20212022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 4 mentions; 0 submissions, 4 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2025

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC202
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC101
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC101
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC413
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC303
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC404
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC202
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC303
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC202

What Hacker News says

22 sources
I've been on Firefox Dev Edition for Mac for the last 4 years I think, and I can't remember more than 1 or 2 websites that didn't work correctly on it. It's been flawless, more battery and memory efficient than Chrome, less finicky and problematic than Safari, and with all the extensions that I need. I seriously don't see any disadvantage in picking Firefox over Chrome. I still have Chrome around if any website requires it specifically, but I haven't launched it in ages. There were a few Chrome extensions that weren't there on Firefox [1] [2] but I fixed that _easily_ by getting the crx file, unpacking it, then adding the https://github.com/mozilla/webextension-polyfill to the extension to make it cross-browser. It's easy enough to make an extension work on both Firefox and Chrome, I've done it myself with SideHN (https://github.com/alin2
Read the rest
In I Switched to Firefox and Never Looked Back
The only really difference sometimes is in the manifest. If you target the webextension api and use the Mozilla poly fill library, your code base does not need to be duplicated at all. It adds the benefit of being able to use all API calls in a promise based manner instead of needing to use callbacks. Edit: To give it a bit more context (although you can find that in other comments I left under this post). The polyfill library itself: https://github.com/mozilla/webextension-polyfill Which if included allows you to swap out `chrome` callback based calls for promise based `browser` calls. So instead of using `chrome.extension.api.call(() => { // callback})` you do something like `await browser.extension.api.call()` with the same results working in both browsers. Then the only thing where you still need some separation is for the manifest a
Read the rest
s some keys are Firefox specific and vice versa. An example you can find here: https://github.com/toolbox-team/reddit-moderator-toolbox Where all code lives in one directory and there is just two manifest files, one for chrome and firefox: https://github.com/toolbox-team/reddit-moderator-toolbox/tre... Building is nothing more than rollup packaging the code and grabbing the right manifest to put in the build directory for each browser: https://github.com/toolbox-team/reddit-moderator-toolbox/blo...
In Plasmo – A framework for building modern Chrome extensions
> The docs supplied by Google are quite good! They are okayish in my book. Personally, I prefer using the MDN docs [0][1] for web extensions as I am using mozilla's polyfill library [2] anyway. These contain more practical examples and less abstract descriptions at times, including a very thorough getting started guide [3] going over everything including various concepts. The point remains the same though, the basics aren't all that difficult and while Plasmo does seem to make some aspects easier it also seems like overkill in other areas in regard to abstraction. [0] https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/Web... [1] https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/Web... [2] https://github.com/mozilla/webextension-polyfill [3] https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/Web...
In Plasmo – A framework for building modern Chrome extensions
Technically correct, but it is a bit more complex. The original web extension API is based on the chrome extension API. So most (there are some annoying exceptions at times) of the chrome extension API calls also work with very little adjustment on firefox. It becomes even easier when you use mozilla's polyfill library https://github.com/mozilla/webextension-polyfill Then you can just target the promise based webextension syntax and as long as you still stick to the calls also available in chrome your extension works with very little effort in both browsers. Safari is a different story which basically amounts to Apple being Apple and sort of supporting webextensions but in such a roundabout way that it is barely worth it for the majority of extension devs.
In Button Stealer
There's standardization work being done at the moment with the W3C WebExtensions Community Group [1] which is definitely a step in the right direction! Mozilla has also done some great work building a web extension polyfill library that attempts to abstract away the differences between the browsers [2] but the translation will always be imperfect, and edge cases are abundant. [1]: https://www.w3.org/community/webextensions/ [2]: https://github.com/mozilla/webextension-polyfill
In Show HN: Plasmo – a framework for building modern Chrome extensions
I used WebExtension polyfill[0] when adapting my FF addon to Chrome and admittedly all the intricate differences between APIs still costed me half a day of work. I managed to have it done with only a few places where I branch on navigator.vendor, but If I wanted to ship different versions to AMO and CWS, I'd make use of something like DefinePlugin[1] for webpack to include/exclude code based on build target. [0] https://github.com/mozilla/webextension-polyfill/ [1] https://github.com/webpack/docs/wiki/list-of-plugins#definep...
In Ask HN: Browser-extension creators, how do you write for multiple browsers?
I mean, the browser apis are close (and Mozilla still has much better documentation) but there are a LOT of edges cases where behavior diverges. Frankly - I'm a little peeved that Optional permissions in Firefox are STILL broken - The prompt can only be triggered in response to a user action, and Firefox blows the fuck up if you put a promise anywhere in between the user click and the call to the api. Which is hugely ironic, since Mozilla is the one pushing to move all the webext APIs to be promise based (and provides a nice helpful library for Chrome/Edge/Safari support: https://github.com/mozilla/webextension-polyfill) which... doesn't work on their platform. Doubly ironic, since the result is that most FF extensions just ask for more permissions up front, which is exactly the opposite of what you'd want in the "secure/private" world
Read the rest
Mozilla claims they're pushing towards.
In Firefox Addons Unable to Update, Undisclosed AMO Issues
I'm going through converting a Chrome extension to Safari 14, and the process isn't nearly as seamless as shown, although it's nice to have the converter tool. Chrome extensions only support the 'chrome' namespace, while Firefox supports 'chrome' and 'browser', but Safari 14 only supports 'browser'. So our extension had been using the 'chrome' namespace which worked under Firefox, but now needed to be converted. 'chrome' uses callback functions, while 'browser' uses Promises. So you have to port your Chrome extension to use 'browser' and use the following polyfill: https://github.com/mozilla/webextension-polyfill Here's some incompatibilities between Chrome and Firefox to consider: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/Web... Also had some html/css glitches to fix in Safari. Some other issues others have mentioned such
Read the rest
as notifications and webRequest APIs.
In How to convert existing web extensions for Safari

Showing the 15 most recent of 22 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.