How to Build a Webpage Annotation Overlay in a Chrome Extension
Drawing over a webpage sounds simple: create a canvas, stretch it across the viewport, and listen for pointer events. That prototype works in a few minutes. Turning it into a usable Chrome extension is a different problem. The overlay must remain sharp on high-density displays, avoid breaking the page when drawing is disabled, preserve annotations while a side panel closes, handle text and erasing, and capture the visible result without sending private page data to a server. I faced those problems while building Markerly, a Manifest V3 extension for drawing, highlighting, typing notes, and saving annotated screenshots. This article walks through the architecture and the design choices that mattered most. Split the extension into three responsibilities The implementation uses three contexts: Context Responsibility Content script Creates the overlay, collects pointer input, and renders strokes Side panel Controls tools, colors, sizes, opacity, capture, and mode Se...