Building Chrome Extensions

Building Chrome Extensions

Wanna learn how to build Chrome extensions? Then this one is probably for you.

Developing and building Chrome extensions from scratch is as cool and amazing as it sounds. And it’s not complicated as it may seem at a first view. In this post, we will be covering all the essentials required to create your own Chrome extensions and build a simple Chrome extension.

And the best part of developing these extensions is that you don’t need to be an expert web developer. Fundamental knowledge of HTML, CSS, and JS is enough to build your own extensions. So, without consuming any more of your time with this intro, let’s get started.

Chrome Extensions are built with four main ingredients -

  • Manifest file
  • Content Script
  • Background Script
  • Popup

There are more things needed but these are the most crucial ones.

Manifest file

It’s a JSON file. Think of it as package.json. It tells us about the version, configurations, name and all the details related while building an extension.

Create a directory named MyExtension(you can name anything you feel like, but in this post, I will refer to it by MyExtension) and inside it create a manifest.json file.


There are a lot more things to be added in this file, which we will see in a few minutes. For a deeper view into manifest file, feel free to look here.

Content Script

A content script bothers itself with the current web page’s content. So, if you want to access Document Object Model(DOM) of the current page from your Chrome extension then this script is where you do that. Any DOM manipulation code goes here.

But we want our manifest file to know where are our content scripts. For that, we have to modify our manifest file.

content_scripts added

Here, the ‘matches’ key is an array which can contain the URLs for which the content script is to be run. In the above example, we want to run the content script for every website so we use <all_urls>. Whenever the page loads, the content script runs.

Let’s create a file content.js in the same directory and write some code in it.


Once we do that we are ready to put our extension on Chrome.

  • Go to chrome://extensions/ .
  • Activate the developer mode.
  • Click on the ‘load unpacked’ button and add your MyExtension directory.

And that’s it, your extension will be activated on your browser and when you visit a page you can open your browser console and check that you have the respective site’s document object.

Since we now know how to use content scripts. Let’s do something cool with it.

Suppose, I wanna change the filter of all the images of every website I visit, It’s very easy. I have to only change the content script.

document.querySelectorAll('img').forEach((item)=>{ = "grayscale(100%)";


Or I wanna speed up the video I watch


item.playbackRate = 2.0;


Ah, it’s okay. But not very useful

True. We want our ‘extension users’ to be able to decide the playback rate so that they control the speed of the video according to their needs, and I’ll get back to it but before that let’s have a look at the background scripts.

Note: Whenever you make changes to any file of the MyExtension directory, you must refresh the extension OR you can download another extension(Extension reloader), this reloads all the unpacked extensions with a single click on a icon.

Background Script

Extensions are event-based programs used to modify or enhance the Chrome browsing experience. Events are browser triggers, such as navigating to a new page, removing a bookmark, or closing a tab. Extensions monitor these events in their background script, then react with specified instructions.

In layman terms, whenever the chrome browser is opened, the background scripts listens for events and responds to these events.

Again we have to make changes in the manifest file for the background scripts,

Now, let’s create a background.js file and write the following code:-

conosle.log('I am a background script');

Now if you refresh and check again there is no message in Chrome console because background script is not a part of the web page.

Go to chrome://extensions, and there exists a ‘i_nspect background page_’ link. Just click on that and there will be a different console with the respective message.

Browser action

browser_actions is used to put icons in the main Google Chrome toolbar, to the right of the address bar. So again the manifest file is to be modified:-


Now, this icon is clickable(fire browser actions) and our background script can listen to these actions.

Communication between the background and the content script

Chrome uses three APIs for the communication between the content and the background script.

Let’s make some changes in the background scripts.


When we click the extension’s icon the background scripts sends the message using sendMessage’ method. The callback function has a tab argument which is basically an object that has all the data for the current tab.

While the content script listens for the event and gets the data_._


Once the icon is clicked, the background script sends the message to the content script.

Now let’s build a chrome extension that allows the user to control the playback speed of the video.

The aim of the extension -> The user clicks on the icon, a popup is created with a slider from which the user can control the speed of the video.


When a user clicks on the extension icon, we want to generate a popup. This popup is an HTML file. But first, we have to update our manifest.json file





We create a popup.html file in the ‘MyExtension’ directory.


Communication between popup & content script

We want to increase or decrease the playback speed of any video, based upon the user input. The best approach would be to take the input in the popup(using a slider) and then pass the slider value to modify the playback rate to the content script.

First, create a popup.js file and update the popup.html file by adding the script tag in it.


While in the popup.js file, we’ll take the slider value and pass it to the content script.


The content scripts get the slider value from the popup and modify the playback speed.


WOHOOO!! Created our first useful chrome extension. For the complete code, check here.

There is a lot more to when building chrome extensions and this post is just to get you started with it. If you want to take your skills to another level, just check out the docs.


In this article, we learned about some cool stuff related to Chrome Extensions. Hope you liked this article and learned something new, and if you did, clap your 💖 out and follow me for more content. Thanks for reading 🙏 Please feel free to comment and ask anything.

Learn more

Learn HTML5 & CSS3 From Scratch - Make Responsive Websites

Full Stack Web Development with Angular and Spring MVC

Creating Web Sites using Python and Flask

Full Stack Developers: Everything You Need to Know

How to Perform Web-Scraping using Node.js

Build a web scraper with Node

Develop a basic website with .NET CORE 3.0 and pure JavaScript

The Web Developer Bootcamp

Angular 7 (formerly Angular 2) - The Complete Guide

The Complete JavaScript Course 2019: Build Real Projects!

Modern React with Redux [2019 Update]

Vue JS 2 - The Complete Guide (incl. Vue Router & Vuex)

Build Responsive Real World Websites with HTML5 and CSS3

The Complete Web Developer Course 2.0

Originally published by Aayush Jaiswal at

Mobile App Development Company India | Ecommerce Web Development Company India

Mobile App Development Company India | Ecommerce Web Development Company India

Best Mobile App Development Company India, WebClues Global is one of the leading web and mobile app development company. Our team offers complete IT solutions including Cross-Platform App Development, CMS & E-Commerce, and UI/UX Design.

We are custom eCommerce Development Company working with all types of industry verticals and providing them end-to-end solutions for their eCommerce store development.

Know more about Top E-Commerce Web Development Company

Best 10 Chrome Extensions for Web Developers

Best 10 Chrome Extensions for Web Developers

In this article, I’m going to present ten Chrome extensions that are geared to optimizing your web development workflow, hopefully making you that little bit more productive.

In this article, I’m going to present ten Chrome extensions that are geared to optimizing your web development workflow, hopefully making you that little bit more productive.

As web developers we work in a very fast paced industry and staying on top of things can sometimes be a challenge. That’s why I believe we should take full advantage of whatever tools we have at our disposal to help keep our heads above water.

What are Chrome Extensions?

As can be read on Chrome’s developer portal, extensions are small software programs that can customize your browsing experience. This can be anything from a spelling and grammar checker that checks your writing as you type, to a password manager that saves your login details for your favorite sites.

There are literally thousands of extensions available for Chrome, all of which can be downloaded for free from the Chrome Web Store. You can check which extensions you currently have installed by visiting the following link in your browser: chrome://extensions/.

Why Chrome?

This article focuses on the Google Chrome browser due to its huge market share (currently 65% and rising). There are also many Chrome-based browsers which support extensions. These include Brave, Vivaldi and, coming soon, Microsoft Edge. However, we should remember that Chrome isn’t the only show in town and that many of the extensions mentioned here have a Firefox and/or Opera equivalent.

Finally, before we dive into the extensions, take a minute to remember that Chrome is proprietary software published by Google. As we all know, there are privacy concerns associated with using Google products, so maybe head over to GitHub and check out the ungoogled-chromium project instead. As the name suggests, this is Google Chromium, sans integration with Google.

1. Web Developer

We’ll start off with the Swiss Army knife of extensions. With over 1 million users and a 4.5 star rating on the Chrome Web Store, Web Developer is something of a must have. It adds a toolbar button to Chrome which, when clicked, displays a plethora of tools that can be used on any web page. These are grouped by category (CSS, forms, images etc) and allow you to do such things as disable JavaScript, outline images with missing alt attributes, resize the browser window, validate a page’s HTML, view a page’s meta tag information and much more.

You can download it here.

2. Your Framework’s Developer Tools

If you’re developing an app with a JavaScript framework and you’re not using that framework’s developer tools, then you’re probably doing it wrong. Let me explain using Vue as an example.

If you have a Vue app which you need to debug, or you just want to see what’s going on under the hood, then what do you do? Inspecting the page’s source will show you the HTML that Vue is rendering, but there is much more to a Vue app than that. What about a component’s props, data or computed properties? Or your app’s state or routing? How do you inspect any of those?

The good news is that the Vue.js dev tools have you covered. Simply install the extension and open it up on a page running a development build of Vue to see exactly what is happening in your app.

Here are links to download the dev tools for the big three frameworks.

3. Daily 2.0 – Source for Busy Developer

As we work in a fast paced industry, keeping up with news and goings on can sometimes be a challenge. Enter Daily 2.0, an extension that gathers the latest web development and tech posts from around the internet and presents them in an attractive masonry-style lay out on your new tab page.

The extension is easy to use. When you install it you are asked to pick from a bunch of categories that interest you and Daily 2.0 does the rest. Hovering over the sidebar on the new tab page allows you to filter your feed based on tags and sources.

You can get it here.

4. Toggl Button: Productivity & Time Tracker

If you’re a busy freelancer, if you work remotely, or if you just need to track the time you’re spending on a project, then Toggl is for you.

This extension requires you to create an account before you can use it. Once you’re logged in it enables quick and easy real time productivity tracking with all the data stored in your Toggl account. It comes with a built-in Pomodoro timer, as well as integrations for a whole host of internet services (such as GitHub, Trello and Slack). One of my favorite features is that it will pop up a notification when you’ve been idle and the timer was running, allowing you to discard the time.

Toggl can be downloaded here.

5. Lighthouse

Lighthouse is an open-source, automated tool for improving the performance and quality of your web pages. You can either install it via the Chrome Web Store or, as of Chrome version 60, you can run it directly from the Audits tab of the browser’s DevTools (press F12 and select Audits).

Once you have opened Lighthouse, click Generate report and optionally select which audit categories to include. Lighthouse will run the selected audits against the page, and generate a report on how well the page did. From there, you can use the failing audits as indicators of how to improve the page. Each audit also includes links to further reading and potential fixes.

Lighthouse is produced by Google, and presumably uses the same ranking factors as their search engine. This means it can offer you some of the best advice out there on how to optimize your site.

You can grab it here.

6. OneTab

So here’s the situation. You’re working on your web app when suddenly you run up against an unexpected bug. You spend a couple of hours tracking down a fix and by the time you’re finished, you have a whole bunch of tabs open in your browser. Add those to the tabs from the project you were working on yesterday, as well as all those articles you haven’t quite got round to reading yet, and pretty soon you find yourself in tab chaos.

This is where the OneTab extension can help you regain a measure of sanity. Whenever you find yourself with too many tabs, click the OneTab icon to convert all of your tabs into a list. When you need to access the tabs again, you can either restore them individually or all at once. Used properly, this extension can give you quite the productivity boost.

OneTab can be downloaded from here.

7. CSS Peeper

CSS Peeper bills itself as a CSS viewer tailored to designers, which allows you to extract CSS and build beautiful style guides. It does this by allowing you to inspect the CSS rules for any element on a page and presenting all of the style information in a simplistic, yet well-organized manner. It also lists all of a page’s colors and images, which can be copied to your clipboard, or exported at the touch of a button.

This extension is considerably easier to use than the browser’s built-in Inspect Element functionality, the only downside is that you cannot change an element’s styles on the fly.

You can find CSS Peeper here.

8. User CSS

This extension goes hand in glove with CSS Peeper, offering a quick and easy way to add custom CSS a web page. Once installed, User CSS is easy to use — you click the extensions icon and enter your styles in the side panel that slides out.

One nice feature of this extension is that your custom CSS styles are persisted. This means you can also use it to permanently hide distracting features on websites you frequent, for example, the trending widget on Twitter.

You can download User CSS here.

9. Web Developer Checklist

Going live with a new project can be stressful at the best of times — there are a whole bunch of things to remember and coordinate. For example, did you remember to validate the site’s HTML? Did you check the SEO? What about accessibility checks? Did you run it through Google Page Speed? The list goes on.

This is where the Web Developer Checklist extension can help. It analyses a web page for violations of best practices and allows you to discover problem areas in your website before you hand it off to your client. The extension is a companion to the excellent

Web Developer Checklist can be downloaded here.

10. Tampermonkey

Userscripts are little computer programs that allow you to alter the behavior of a web page. These can be used for a variety of tasks, such as tweaking a site’s layout to your preferences, adding extra functionality to a page, or automating repetitive tasks.

Tampermonkey is a userscript manager — an extension that allows you to manage and run userscripts, as well as create your own. And it’s this last capability that has earned it a place on the list, as you can use Tampermonkey to great effect to streamline your web development workflow. For example, I was recently working on a large form which I needed to test. Instead of manually entering the values every time, I wrote a Tampermonkey script to do that for me, saving me countless keystrokes.

Tampermonkey can be found here.


In this post we have looked at ten of my favorite Chrome extensions to boost your web development workflow. I hope this has given you some inspiration, but please remember that this list is by no means exhaustive.

If I’ve missed your favorite extension, or you have a gem to share with other readers, I’d be glad to hear from you in the comments below.

Hire PHP Developer and Web Developer for your Online Business

Hire PHP Developer and Web Developer for your Online Business

PHP is widely used open-source scripting language it helps in making dynamically easy your websites and web application. Mobiweb Technology is your best technical partner and offering you solution for any kind of website and application...

PHP is widely used open-source scripting language it helps in making dynamically easy your websites and web application. Mobiweb Technology is your best technical partner and offering you solution for any kind of website and application development. To hire PHP developer and web developer at affordable prices contact Mobiweb Technology via [email protected]