Building a browser extension in vanilla JavaScript

Insights and learnings

Hi! 👋

I’m Sebastian.

Frontend developer @

A quick history

Old workflow

New workflow

Omnivore + … ?

My extension

Omnivore List Popup!

My extension

Omnivore List Popup!

Features:

  • Loads and displays Omnivore articles via their API
  • Adding new articles
  • Basic editing features (archiving, deleting, editing labels)
  • Some handy links to the main Omnivore webapp

My extension

Available for Firefox and Chrome

It’s going to be a simple little web app,
React seems like overkill here.

Sebastian

Insights and
learnings

🌟 Good things

  • In theory, web extensions are easy to build:
    • HTML, CSS, JS, manifest.json
  • Easy local development: Load the folder and use dev tools!
  • The web extension standard is generally cool
    • ✅ Chrome (incl. Chromium, Vivaldi, Brave, Arc, …)
    • ✅ Firefox
    • ✅ Safari (in theory)

🌟 Good things

🌟 Good things

  • It’s fun to reach out to the community, and see users and ratings coming in!
  • … and they will ask for a Chrome port immediately.

💩 Bad things

Manifest V2 vs. Manifest V3 makes things complicated:

  • V3 is contended and boycotted by many extensions.
  • Firefox’s support isn’t complete yet (bug).
  • I didn’t manage to migrate my API calls to V3 in Firefox.
  • Some build tools help you maintain two sets of manifests, e.g. V2 for Firefox and V3 for Chrome.

💩 Bad things

Safari support isn’t worth it for me (Apple Developer Program → $99 per year).

💩 Bad things

People will make you shady offers …

💡 Learnings

Even a little extension like mine already has many UI states (to have a good UX):

  • Onboarding state
  • Loading state
  • Error state (+ dedicated errors)
  • Empty state
  • Main state (list with pagination)
  • Label modal
  • Settings page

💡 Learnings

I quickly missed a lot of development features:

  • Splitting code into multiple files
  • Using TypeScript
  • Auto-reload in the browser

💡 Learnings

I ended up building some Node scripts for:

  • bundling files,
  • processing manifests,
  • preparing zip archives, …

 

… and eventually, I migrated to a less manual setup with Vite.

💡 Learnings

Next time I would use …

  • A UI framework (Vue.js, React, Handlebars, …)?

💡 Bonus learning

CSS accent-color property for checkboxes 😍

Thank you!

Any questions?

Building a browser extension in vanilla JavaScript

By Sebastian Herrmann

Building a browser extension in vanilla JavaScript

Insights and learnings from building the browser extension “Omnivore List Popup”.

  • 157