Unlocking the Power of Web Chrome Extensions: A Comprehensive Guide to Building Your Own

Fayaz Ali
Google for Developers EMEA
3 min readMar 30, 2024

--

In today’s digital age, web browsers serve as the gateway to the internet, offering users an array of functionalities and customization options. Among these, Chrome extensions stand out as powerful tools that enhance browsing experiences, streamline workflows, and add valuable features.

In this Medium publication, we delve into the world of web Chrome extensions, offering a step-by-step guide for developers and enthusiasts alike to create their own. From conceptualization to deployment, we’ll explore the essential components of extension development, including designing user interfaces, integrating APIs, implementing functionality with JavaScript, and ensuring compatibility across devices.

Whether you’re a seasoned developer looking to expand your skill set or a newcomer eager to explore the realm of browser customization, this publication will provide you with the knowledge and resources needed to embark on your extension-building journey. Join us as we unlock the potential of web Chrome extensions and empower users to tailor their browsing experiences to their unique preferences and needs.

Lets break down the steps to make your Personal Chrome Extensions

  1. Open VS Code and make a directory then make file name as “manifest.json
    The manifest.json file is like a blueprint for Chrome extensions. It contains crucial information such as the extension’s name, permissions it needs, scripts it runs, icons it uses, and more. This file tells Chrome how the extension should behave and what it’s allowed to do.

//This will make a overall skeleton of your Extension give it name according to your choice
{
"name": "TODAY JOKE",
"description": "Enjoy your joke of the day",
"version": "1.0",
"manifest_version":3,
"action":{
"default_popup":"popup.html",
"default_icon":"fav1.png"
}

}

2. We will make a another file “Popup.html” where we can write the headline and description of our extension.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Joke of the day</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<p>Enjoy your joke of the day! </p>
<p id="Joke">Load Again</p>

<script src="index.js"></script>
</body>
</html>

3. We make the basic structure but the style is not good if you check so we will style it and for that we will make another file “style.css” .

p{
padding: 10px;
font-size: 16px;
min-width: 100px;
width: 300px;
box-shadow: rgba(100, 100, 111, 0.2)0px 7px 29px 0px;
}

4. Now we want to show something when we click on our extension so we need some Public API and we know that our extension is for daily joke then will synced when we click on it and it will show different jokes you can make some other extension also it depend on your API key and your overall extension . So we will make a file name as “index.js” and Put our API key there with other functionalities.

const Joke = async()=>{

try{

const res= await fetch("https://api.chucknorris.io/jokes/random");
const data = await res.json();
const findjoke =document.querySelector('#Joke');
findjoke.innerHTML = data.value;

} catch (error) {}
};


window.addEventListener("load", () =>{
Joke();
});

5. Last but not least make sure to add your logo for your extension and you can see in my manifest.json file i have added it as default icon make sure to just add the icon in the directory .

Well then we are ready to go and if you follow my steps then defiantly your extension will work still if its not working just let me know in the comment section and if you cant do it and looking for source code then you can ask in comment i will provide it you .

if you want to make your extension Public and want others to see it you need to spend around 5$ in Web chrome store.

API KEY FOR DAILY JOKES YOU CAN USE FREELY

https://api.chucknorris.io/jokes/random

Thanks for reading my article follow me for more interested articles related to technology and development.

#softwaredevelopment #articlewriting

--

--