Kritim Yantra
Jun 14, 2025
π Ever wanted to build a Chrome extension but thought it was too hard? Think again! In under 30 minutes, you can create a custom extension that modifies websites, blocks distractions, or even replaces all images with cats.
In this guide, youβll learn:
β
What makes Chrome extensions so powerful (and easy!)
β
The 3 essential files every extension needs
β
How to build a real extension from scratch
β
How to publish it to the Chrome Web Store (optional)
No prior extension experience neededβjust basic HTML, CSS, and JavaScript. Letβs dive in!
Extensions are just HTML, CSS, and JS wrapped in a special folder. If you can build a website, you can build an extension!
All extensions require:
manifest.json
β The "settings" file (like package.json
for Node.js). popup.html
(optional) β The UI when you click the extension icon. background.js
(optional) β Runs code in the background. content.js
(optional) β Modifies web pages directly.my-extension/
βββ manifest.json
βββ popup.html
βββ popup.css
βββ popup.js
βββ icons/
βββ icon16.png
βββ icon48.png
βββ icon128.png
manifest.json
)This file tells Chrome:
{
"manifest_version": 3,
"name": "My First Extension",
"version": "1.0",
"description": "A simple Chrome extension demo!",
"icons": {
"16": "icons/icon16.png",
"48": "icons/icon48.png",
"128": "icons/icon128.png"
},
"action": {
"default_popup": "popup.html"
},
"permissions": ["activeTab"]
}
πΉ Key Fields:
manifest_version
: Always 3 (newest standard). action
: Defines what happens when you click the extension icon. permissions
: Requests access to browser features (e.g., "storage"
, "tabs"
).popup.html
)This is the small window that appears when you click your extensionβs icon.
<!DOCTYPE html>
<html>
<head>
<title>My Extension</title>
<link rel="stylesheet" href="popup.css">
</head>
<body>
<h1>Hello, World! π</h1>
<button id="changeTextBtn">Click Me</button>
<script src="popup.js"></script>
</body>
</html>
Style it with popup.css
:
body {
width: 200px;
padding: 10px;
text-align: center;
font-family: Arial, sans-serif;
}
button {
background: #4285F4;
color: white;
border: none;
padding: 8px 16px;
cursor: pointer;
}
popup.js
)Letβs make the button change the text when clicked.
document.getElementById("changeTextBtn").addEventListener("click", () => {
document.querySelector("h1").textContent = "Button Clicked! π";
});
chrome://extensions
in Chrome. π Your extension is now live! Click its icon to see the popup.
content.js
)Want to change websites dynamically? Use a content script.
manifest.json
:{
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["content.js"]
}
]
}
content.js
:// Replace all paragraphs with "Hello, Extension!"
document.querySelectorAll("p").forEach(p => {
p.textContent = "Hello, Extension!";
});
Reload your extension and visit any pageβyouβll see the magic!
β Chrome extensions = HTML/CSS/JS + manifest.json
β popup.html
= UI when clicking the icon
β content.js
= Modify web pages directly
β Test locally first, then publish if needed
π‘ Try these fun ideas:
π Resources:
What will you build? Share your ideas below! π
Transform from beginner to Laravel expert with our personalized Coaching Class starting June 21, 2025. Limited enrollment ensures focused attention.
1-hour personalized coaching
Build portfolio applications
Industry-standard techniques
Interview prep & job guidance
Complete your application to secure your spot
Thank you for your interest in our Laravel mentorship program. We'll contact you within 24 hours with next steps.
No comments yet. Be the first to comment!
Please log in to post a comment:
Sign in with Google