How to Build a Chrome Extension

Join Shop Free Mart! Sign up for free!

How to Build a Chrome Extension

Have you ever been caught doing a repetitive activity and need you possibly can automate your course of?

Are you uninterested in spending time looking for an acceptable extension, solely to be met with an empty search end result web page?

Luckily, when you’re a Chrome consumer, you may create a Chrome extension in simply eight easy steps.

How do we all know? We created our personal Ubersuggest Google Chrome Extension to streamline our key phrase analysis methods.

In this publish, we’ll present you ways to make a Chrome extension to aid you innovate your duties and get again to productive work.

What is a Chrome Extension?

Google Chrome extensions are packages you may set up in your Chrome browser to change its performance.

Chrome extensions may also help you automate sure features in your browser, modify current behaviors, and enhance your software program’s comfort. There are even Chrome extensions that may enhance your website positioning.

Chrome extensions are constructed with HTML, JavaScript, and CSS scripts and are basically small web sites uploaded to the Chrome retailer.

The solely distinction between a Chrome extension and a common web site is that Chrome extensions include a manifest file, which supplies them a particular operate to execute.

Another means to take into consideration Chrome extensions is that they’re a piece of code that modifications your browser expertise.

For instance, the Grammarly Chrome extension permits you to edit and modify your copy as you write. The LastPass extension will allow you to maintain your password supervisor inside your browser.

Here are 13 of our favourite Google Chrome extensions for you to think about.

What Can Chrome Extensions Do?

A custom-built extension can carry out a single activity. This activity wants to be narrowly outlined and straightforward to perceive for it to work correctly.

You can embrace a couple of element or performance, so long as all the pieces directs the extension in the direction of a singular purpose.

Chrome extensions work through the use of both web page actions or browser actions.

A web page motion is an motion that’s particular to sure pages.

A browser motion is related irrespective of the place you’re within the browser.

As effectively, your consumer interfaces want to be user-friendly and simple. These can vary from a single icon, consider the Gmail icon, or you may override a complete web page to your interface.

Your ultimate deliverable might be a zipped .crx package deal that customers will obtain and set up.

Why Should I Create a Chrome Extension?

Google Chrome is essentially the most extensively used searching software program on the earth. According to W3Counter, Chrome has 65.three % of the full market share.

You must also create a Chrome extension in case you are wanting to add a easy motion to your browser expertise.

The good thing about Chrome extensions versus common purposes is they’re usually simpler to construct and keep. Because Chrome extensions are constructed round a singular operate, they take much less time and expertise to create.

Building a Chrome extension usually takes far much less time than constructing a completely new webpage.

If you need a easy and efficient means to modify your browser, then constructing a Chrome extension is the way in which to go.

Chrome extensions may enhance your net visitors, see extra within the video under.

What Makes a Chrome Extension Successful?

A profitable Google Chrome extension will simplify a activity or performance and enhance your productiveness.

Let’s think about you’re an e-commerce net builder and also you’re researching competitor outlets. If you put in the Koala Inspector extension, you’ll have the ability to see if Shopify constructed any web site you land on. You may see what theme was used, if any new updates have been made, and look at product statistics.

Another Chrome extension, the News Feed Eradicator for Facebook, may also help enhance your productiveness by blocking your information feed so you may focus in your duties. It is a easy however efficient operate that may aid you enhance your each day workflow.

Both of those extensions execute a easy performance that improves consumer expertise. When constructing a Chrome extension, maintain simplicity in thoughts. That’s the key to a profitable extension.

Your Step-by-Step Guide to Creating a Chrome Extension

Now it’s time to construct your Chrome extension.

It’s vital to word that you simply want to do that on Google Chrome. This may appear apparent, however not everybody makes use of Chrome as their default browser.

If you aren’t a common Chrome consumer, make sure to set up it earlier than you start these steps.

Also, make sure to test your work regularly as you progress by means of this course of. It’s a lot simpler to repair coding errors within the second than after you end.

Build a Chrome Extension Step 1: Determine What Your Extension Needs

The first step in constructing your Chrome extension is to resolve on a performance.

What will it do? What will it appear to be?

If you need to create an extension to your Google AdWords campaigns, that is the time to resolve on the way it will work.

An icon is required for all Chrome extensions to be uploaded to the Google Chrome retailer. Be positive to create or outsource an icon earlier than you start.

Once you recognize what your Chrome extension will do, and what you need it to appear to be, you can begin constructing it out.

Below, we’re going to present you ways to construct an extension that may allow you to change the background shade of your present web page.

Build a Chrome Extension Step 2: Create a Directory for Your Extension

To start constructing your Chrome extension, you’ll want to create a new listing to home your entire extension’s recordsdata.

This is vital as a result of, for Chrome to load your plugin, it wants to be pointed in the direction of a folder containing your extension recordsdata.

You can add the entire recordsdata you will want to your extension into this listing.

Build a Chrome Extension Step three: Make Your Extension’s Manifest File

The subsequent step is to create your extension’s manifest file.

This file will inform Chrome how to load the extension correctly.

Create a file known as manifest.json and add it to your listing.

Then, add any code you would possibly want to your manifest file.

For our functions, the code will appear to be this:

“name”: “Getting Started Example”,

“description”: “Build an Extension!”,

“version”: “1.0”,

“manifest_version”: three

Build a Chrome Extension Step four: Load Your Extension into Chrome and Check for Errors

Now it’s time to check your extension to be sure Chrome will run it.

Follow these steps:

  1. Go to chrome://extensions in your Google Chrome browser
  2. Check the Developer mode checkbox within the high right-hand nook
  3. Click “Load Unpacked” to see a file-selection dialog
  4. Select your extension listing
example of google chrome extension loading screen

If your extension is legitimate, it ought to load instantly.

If it’s invalid, you will note an error message on the high of your web page. If that is the case, search for errors, appropriate them, and check out loading your extension once more.

The most typical errors folks make listed here are syntax errors. Double-check your entire commas and brackets and ensure they’re formatted appropriately.

Also, be sure the Enabled field subsequent to your extension is checked so you may see it performing dwell.

Build a Chrome Extension Step 5: Develop Your Background Script

Next, you’ll want to add some background script to inform your extension what to do.

First, create a file named background.js inside your extensions listing.

Then, add your script.

For our color-changing extension, we’ll be utilizing this script:

“name”: “Getting Started Example”,

“description”: “Build an Extension!”,

“version”: “1.0”,

“manifest_version”: three,


“service_worker”: “background.js”

This file will alert Chrome that it wants to scan for added directions.

The extension we’re constructing will even require a listening occasion for runtime.onInstalled inside the background script.

Within the onInstall listener, the extension will set a worth with the storage API. This permits a number of extension elements to run and edit that worth.

let shade = ‘#3aa757’;

chrome.runtime.onInstalled.addListener(() => );

Most API’s will want to be registered within the “permissions” subject of your manifest. Like this:

Next, return to your extension administration web page and click on Reload.

You ought to see a new subject for Inspect views come up. There will even be an accompanying blue hyperlink that reads the background web page.

example of chrome extension builder interface

Click the hyperlink and you will note the background script’s console log, which reads “Default background color set to green”.

Content scripts may also be added to run page-by-page scripts.

Content scripts needs to be added straight into your manifest file.

Build a Chrome Extension Step 6: Create Your User Interface

Your extension can have a vary of user-interfaces, from pop-ups to tooltips, and extra.

To start designing your interface, you want to register a browser motion in your manifest.

For our instance, we’ll use a pop-up. The code seems to be like this:

<!DOCTYPE html>



<hyperlink rel=”stylesheet” href=”button.css”>



<button id=”changeColor”></button>



You’ll want to declare this code inside your manifest to ensure that it to work.

To do that, add an motion to your manifest and set popup.html because the motion’s default_popup.

Your script ought to appear to be this:

“name”: “Getting Started Example”,

“description”: “Build an Extension!”,

“version”: “1.0”,

“manifest_version”: three,


“service_worker”: “background.js”


“permissions”: [“storage”],


“default_popup”: “popup.html”

This particular pop-up references a CSS script, so that you’ll want to add one other file to your listing. Name it appropriately, and add this:



box-shadow: zero zero zero 2px white,

zero zero zero 4px black;

For our instance, you’ll additionally need to add shade to your popup buttons. Later on, this shade might be used for the background of your web page as effectively.

Create and add a file named popup.js with the next code to the listing.

// Initialize button with consumer’s most well-liked shade

let changeColor = doc.getElementById(“changeColor”);“color”, ( shade ) => );

This will seize the button from popup.html and request the colour worth. Include a script tag to popup.js in popup.html like this:

<!DOCTYPE html>



<hyperlink rel=”stylesheet” href=”button.css”>



<button id=”changeColor”></button>

<script src=”popup.js”></script>



From there, you may add badges to present the state of your extension. For instance, a badge can inform a consumer if the extension is activated or not, on or off.

an icon showing on funtionality and a water drop below it

Toolbar icons fall underneath motion within the default_icons subject.

Place any desired photos inside your listing after which inform the extension how to use the photographs.

For photos, 16×16 and 32×32 sizes are really useful. All icons needs to be sq., or else they might find yourself distorted.

If you don’t provide an icon, Chrome will add a default one for you.

When designing your Chrome extension consumer interface, maintain it easy and user-friendly.

Google says all extension interfaces ought to add to a searching expertise, not distract from it.

Before transferring on, reload your extension and ensure all the pieces seems to be proper.

Build a Chrome Extension Step 7: Add in Some Logic

Logic furthers your consumer interface interplay.

Add logic scripts to no matter user-interface choices you included.

Logic can inform your extension to carry out sure actions, akin to what to do when a button is clicked.

For instance, when you used the popup.js script, you’ll need to embrace your logic on the finish of it.

For our instance, you should use this script:

// When the button is clicked, inject setPageBackgroundColoration into present web page

changeColor.addEventListener(“click”, async () =>

  let [tab] = await chrome.tabs.question();


    goal: tabId: ,

    operate: setPageBackgroundColoration,



// The physique of this operate might be executed as a content material script contained in the

// present web page

operate setPageBackgroundColoration()

operate setPageBackgroundColoration()“color”, ( shade ) => );

This code triggers a programmatically injected content material script. This turns the background shade of the web page to the identical shade as your beforehand added button.

From right here, your extension needs to be totally useful. Any new additions might be bells and whistles.

Build a Chrome Extension Step eight: Test Out Your Extension

Just like A/B testing in advertising, it’s vital to repeatedly check your extension to guarantee all the pieces works.

Test it out your self, or have another person check it.

If you’ve one other particular person check it, do it with out giving them directions to be sure it’s intuitive to use.

Make modifications as wanted, then check your extension once more.

Even after you launch your extension, you may repeatedly optimize and enhance it. That’s how we acquired the Ubersuggest Chrome extension

Once you’re glad, it’s prepared to use.

Can I Practice Making a Chrome Extension?

Once you add your extension to the Chrome retailer it’s dwell and usable.

If you don’t need your Chrome extension to be publicly accessible, you may all the time make a GitHub repo that individuals can clone from.

This requires giving folks entry to your supply code, so make sure to think about this earlier than importing something onto GitHub.

You may experiment with open supply samples earlier than diving into your extension.

Samples for Chrome Extensions can be found on Google’s GitHub.


Creating a Google Chrome extension is a smart way to enhance your browser performance and create optimum consumer experiences.

What’s extra, your software can drive visitors to your web site, so modifying that have can lead to new leads for your online business.

Remember, a few of the most highly effective Chrome extensions had been constructed by folks identical to you!

It could also be a studying curve to get your extension the place you need it to be, but it surely’s price it when you’ve an thrilling new characteristic to showcase to your folks—and potential shoppers.

What form of Chrome extensions have you ever constructed?

Join Shop Free Mart! Sign up for free!

Be the first to comment

Leave a Reply

Your email address will not be published.