Extension foundations

Create the Manifest V3 file

Declare the extension identity, version, popup action, permissions, and packaged files in a minimal manifest.json.

Every extension starts with a manifest.json file in the root folder. It tells the browser what’s in the package and what the extension is allowed to do.

We use Manifest V3, the current Chrome extensions platform. The manifest is plain JSON, no code in it.

Configuration and trust in one file

The manifest does two jobs. It’s configuration: name, version, which HTML file opens when you click the toolbar icon. And it’s a declaration of trust: the permissions you list here are what the user agrees to when they install.

There are a few kinds of permissions, and it pays to know the difference:

  • API permissions like storage and scripting enable extension APIs
  • host permissions grant access to websites matching a pattern, and Chrome warns the user about them
  • activeTab is special: it grants temporary access to the current tab, only after the user clicks your icon or uses your shortcut

Page Notes never needs host permissions. activeTab is enough.

The manifest for Page Notes

Here is the complete manifest we’ll end up with at the end of the course:

{
  "manifest_version": 3,
  "name": "Page Notes",
  "version": "1.0.0",
  "description": "Save a note for the current page",
  "action": { "default_popup": "popup.html" },
  "permissions": ["storage", "activeTab", "scripting"]
}

action defines the toolbar icon and its popup. permissions lists the three capabilities we budgeted in the previous lesson.

I’m showing the final version so you can see the whole picture. In your project, don’t start there. Start with only manifest_version, name, version, and action. Then add each permission in the lesson that uses it.

Why the slow way? Because when a permission arrives together with the code that needs it, anyone reading the history can see why it’s there. A permission nobody can explain is the first thing I remove in a review.

Version numbers

Chrome wants the version as one to four numbers separated by dots, like 1.0.0 or 2.3. No v prefix, no -beta suffix. Every package you publish must have a higher version than the previous one, or the store rejects it.

Start the project

Create a folder called page-notes. Put the manifest inside, with the fields above but an empty permissions array. Add a popup.html that contains only a heading, so the action has something to open.

Then add storage, activeTab, and scripting one at a time, and next to each write a single line: the API it enables and the visible thing the user gets from it. We’ll load this folder into Chrome in the next lesson.

Lesson completed