CHROME EXTENSION BASICS / 01.02 · Learn · 5 min
One folder, four connected files
Keep your extension’s files together in one folder. Chrome looks for a file named manifest.json at the root of that folder.
daily-coding-goal/
manifest.json
popup.html
popup.css
popup.js
manifest.json describes the extension
The manifest tells Chrome the extension’s name, version, permissions and popup entry point. Our projects use Manifest V3. JSON property names and text values use double quotes, and the last property does not have a trailing comma.
The action.default_popup setting points to popup.html. Think of that path as a connection: if the name does not match the file, Chrome cannot open the page you intended.
popup.html creates the interface
The HTML contains the heading, goal field, Save button and feedback. It also links to popup.css and loads popup.js. The workshop gives you a document shell, then you build the visible content.
popup.css styles the interface
CSS makes the popup comfortable to use. You will give it a width, add spacing and make its button easy to spot. A stylesheet only affects the page if its HTML link points to the right file.
popup.js handles behavior
JavaScript finds the field and button, responds to a click, saves the goal and restores it when the popup opens again. Keep this code in its own file. The HTML loads it with defer so its elements are ready when the script runs.
Ask for only what you need
This project requests the storage permission. It does not need permission to read every website, collect browsing history or contact a server. In later projects, we will introduce additional permissions only when a feature calls for them.
Check your understanding
Trace the connections before coding: Chrome reads the manifest, the manifest points to the popup HTML, and the HTML loads its CSS and JavaScript. If something does not load, start by checking those file names.
Reference: Chrome’s manifest documentation.