Blog / Build with AI /

Building a page notes extension with AI

You’re researching something across fifteen tabs, and you keep thinking, “I should write down why I opened this one.” You put a sticky note on your screen, or a line in a document, and then lose both.

What if every page could carry its own note? You open a page, click an icon, type “check the pricing table before Friday”, and the next time you visit that page the note is there waiting.

That’s a page notes extension, and it’s a very good beginner project for building with AI. It’s small, the logic is simple, and the result is something you’d use. Here’s how to approach it.

What we’re building

A Chrome extension (it works in other Chromium browsers too) with:

  • A toolbar button that opens a small popup.
  • A text box that shows the note for the current page’s address.
  • Automatic saving as you type.
  • A “clear” button.

All data stays on your own computer. No server, no account.

What’s inside an extension

A Chrome extension is a folder of ordinary web files plus a settings file. For this one you need three:

  1. manifest.json: the ID card. It tells the browser the extension’s name, what it can access and which file is the popup.
  2. popup.html: the little window with the text box.
  3. popup.js: the code that loads and saves the note.

Chrome currently requires the newer extension format, called Manifest V3, so tell the AI to use it. Older tutorials online use Manifest V2, which Chrome is phasing out, and a model trained on a lot of old examples may slip back into it.

The prompt

Write a Chrome extension using Manifest V3 with three files: manifest.json, popup.html and popup.js. The popup contains a textarea and a Clear button. When opened, it finds the URL of the active tab, loads any saved note for that URL from chrome.storage.local, and shows it. As the user types, save the note under that URL (debounce by 500 ms). Request only the permissions needed: storage and activeTab. Use no external libraries and no remote code. Add comments. Then tell me how to load it in Chrome as an unpacked extension.

The permissions sentence is important. Extensions can ask for broad powers, like reading every page you visit. A notes tool doesn’t need that, and asking for less is good practice for any extension you might share later.

What the pieces look like

manifest.json

{
  "manifest_version": 3,
  "name": "Page Notes",
  "version": "1.0",
  "description": "Keep a short note against each web page.",
  "permissions": ["storage", "activeTab"],
  "action": { "default_popup": "popup.html" }
}

popup.js (core idea)

const box = document.getElementById("note");
let key;

chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
  key = tabs[0].url;
  chrome.storage.local.get(key, (data) => {
    box.value = data[key] || "";
  });
});

let timer;
box.addEventListener("input", () => {
  clearTimeout(timer);
  timer = setTimeout(() => {
    chrome.storage.local.set({ [key]: box.value });
  }, 500);
});

Read it in order: find the current tab’s address, use it as the storage key, load whatever’s saved, then save changes half a second after typing stops. That “wait half a second” is the debounce, and it stops the extension from saving on every keystroke.

Reading the active tab’s URL works with the activeTab permission when the user clicks the extension, which is why you don’t need a broad “all sites” permission. If the AI’s version asks for <all_urls> or tabs, ask why and whether it can do without.

Load it and try it

  1. Put the files in a folder.
  2. Open chrome://extensions in Chrome.
  3. Switch on Developer mode (top right).
  4. Click “Load unpacked” and choose your folder.
  5. Pin the extension to the toolbar, open any page and click it.

If it doesn’t appear, the usual cause is a typo in manifest.json: a missing comma or a wrong filename. Chrome shows an error on the extensions page. Paste that message back to the AI, along with your manifest.

Testing

Test What should happen
Type a note, close the popup, reopen it The note is still there
Open a different page A blank box
Return to the first page The first note comes back
Press Clear The note disappears and stays gone
Open a new tab page or a chrome:// page No crash; ideally a friendly message

The last one catches people out. Chrome blocks extensions on some internal pages, and the popup may behave oddly. A good version handles it politely.

Decisions you’ll bump into

What counts as “the same page”? The full URL includes things after a ? or #, such as tracking parameters, so the same article can appear to be several pages. You can store notes under the address with these parts stripped. Ask the AI to do it, and decide whether you want it. For some sites, those parameters change the page, and you wouldn’t want to merge them.

Where is the data? chrome.storage.local keeps it on that browser profile only. Clear your browser data or reinstall, and it can go. If notes matter, add an export button that downloads them as a text or JSON file. chrome.storage.sync can sync across your signed-in browsers, but it has small size limits.

Privacy. The notes could include sensitive things. Keep them local, and say so if you ever share the extension.

Ideas for version two

  • A badge on the icon showing that a page has a note.
  • A list of all your notes, searchable.
  • Export and import.
  • A keyboard shortcut to open the popup.
  • Notes for a whole website, not just one page.

Add them one at a time and test after each. I covered the general method in building a tiny tool with AI, from idea to working page in an afternoon.

If you ever want to publish it

Publishing to the Chrome Web Store involves a developer account, a one-time fee, a privacy disclosure and a review. Before then, you’d want a proper icon, a clear description, and a privacy statement that says what is stored and where. It’s more work than the code, so decide whether the extension is just for you.

Key takeaways

  • A page notes extension needs three files and very little code.
  • Specify Manifest V3 and minimal permissions in your prompt.
  • Load it unpacked from chrome://extensions to test.
  • Decide how to treat URLs with query strings, and where notes live.

What would you save on a page? A reminder, a quote, a to-do? That answer decides what version two looks like.