11Jan 2021

All You Need To Know About Chrome Extension Development

Are you looking for ways to create Chrome extensions or chrome extension development? It is, in fact, one of the easiest things that you can help yourself to with little or no knowledge about the technical side of the web. We are sharing a step-by-step guide here to help you with the process. Here, you will be given an introduction on how to publish extensions in the Chrome Web Store.

But before that let us find out more about Chrome extension.

Chrome Extension

Chrome Extension

This feature provides you with the provision to add functionalities to the Chrome web browser without the need to dig deeply into the code that lies beneath. In fact, web developers utilize this facility as it allows them to create new and fresh extensions to Chrome – if they have an in-depth knowledge of the core technologies, including CSS frameworks, Javascript, and HTML. It is nothing as building a web page – in fact, developing an extension is way far easier and involves less tedious steps than anything else that you would do over the web. But, the challenge lies in having knowledge on how to successfully add functionality to Chrome using Javascript APIs (that Chrome offers).

If you are starting to learn about web development and design in a web development company India, then you should wait until you gain some basic idea about how it works before you delve into creating Chrome extensions.

So let us see further how we are going to deal with this.

Like any other task, it is important to have a strategy drafted before you start creating Chrome extensions. You need not be doing it on the professional front, but if you believe that you need to do some base work before starting over with the big ones, then this is where you can begin.

Getting Into the Bigger Picture

We will give you some examples to begin with. For example, if you have ever used the Unsplash Chrome extension, then you might be aware of how it helps in creating background images. But, you can even use the Muzli Chrome extension development instead (this helps in transforming tabs into feed of design news and shots from the web).

A Focus on Quality

A focus on quality

Before we set out to get ready with the Chrome extension ideas, there are a few other points to be noted, such as the quality guidelines.

As you might be aware, the developer program policies from Google are accompanied with a set of standards and policies, which help contribute to building an extension for Chrome. And ‘purpose’ forms one of the most important factors that contribute to quality. One of the single purposes that an extension is expected to fulfill is clearly described and very easy to grasp. This one extension comprises more than one entities and multiple functionalities, and all these serve the same purpose. Google has been particular about the fact that a Chrome extension development should serve not more than one purpose when in a particular scenario. This is mainly intended to avoid any bad browser performance issues that might arise from a highly packed up browser UI. Some of the criteria that you need to check when ensuring the quality include:

  • Always ensure that the permissions set for your extension are only the necessary ones. If anything excess has been added up, then it would lead to a policy violation.
  • It is always better to not bring in new functionalities and settings to your browser.

Let us take a look at what are the UI Guidelines for Chrome extension

Though it is easy to create Chrome extensions, on the technical front, creating a Chrome extension is more or less like building a web page. But this doesn’t apply to the feel and experiences, i.e., the user experience and user interface that the extension is expected to provide. It is important that we draw a line of difference as every extension is here to serve a different use case or purpose. While some extensions are here to add UI to Chrome browser, known as page or browser actions – any Chrome extension can serve either one browser action or one-page action.

alsoRead

Motion UI Design

Let us take a look at what a browser action is and also find out more about ‘page actions’.

Browser action is nothing but a Chrome extension that would be relevant for website or web apps.

When it comes to page actions, you would be building an extension that can be implemented across a few web pages. With page actions, you can have a clear picture of what actions can be taken within the current page – but remember these cannot be applied to any of the web pages.

Whenever the user is inactive or doesn’t visit the relevant web page, Chrome extensions with page actions would be inactive or greyed out.

We will take you through the steps in setting up a Chrome extension

Step 1

Starting With The Setup

It is important that you start with this step, where you would be creating a manifest file by the name manifest.json. This metadata file in the format of JSON will hold certain properties, including the name of your extension, version number, and description. This is the file, which gives details to Chrome regarding what the extension is expected to do and what permission would it need further.

So now you have the most possible and basic extension which is a directory with a manifest.json file. First, create the directory and then put the below-given JSON into the manifest.json. It looks something like the below-given:

{

 “manifest_version”: 2,

 “name”: “My Cool Extension”,

 “version”: “0.1”

}

You have seen the most possible and basic manifest.json that carries all the fields that are filled in. Make sure that the version for your manifest is 2 and not 1, as 1 is no longer supported now. As you can see, the manifest.json would not perform any actions until you load it into the browser. So, this makes it clear that the manifest.json comprises browser actions. We can do a lot more at this stage. For example, if you wish to display a popup, you can use something like the below-given:

“browser_action”: {
 “default_popup”: “popup.html”,
},

What this will do is render popup.html within the popup window. This popup window is opened or created in response to the user’s actions across the browser. Since this would be a standard HTML file, you will have a control over what the popup will display. So let us add something to the ‘popup.html’ and see what happens next.

Step 2

Finding Out Whether We Are On The Right Path

Finding out whether we are on the right path

Let us see whether the ‘Hello World!’ will be displayed.

<!doctype html>
<html>
 <head>
   <title>Test</title>
 </head>
 <body>
   <h1>Hello World!</h1>
 </body>
</html>

See whether this works. For that, you need to visit chrome://extensions in your browser. Here you have to examine whether the ‘Developer mode checkbox’ that appears on the right-hand side is checked. Next, you need to click the ‘Load unpacked extension’. Here, you should be selecting the directory within which your extension files have been embedded. And now the big question what if the extension is valid – it will be active no doubt. And you can easily open a new tab where you will see your ‘Hello World’ displayed.

Step 3

Let Us Work On Some Improvisation

Now you have everything put in place. This feature has started functioning. So, now it is time to make it appear good and beautiful. You can do this by adding style to the new tab, which you can do by creating a main.css file within the extension directory and load this within the ‘newtab.html file’. You can apply the same functionality when trying to include a Javascript file for any active functionality you wish to include. Here is something that you could do to set out for creating extensions ahead.

How Do We Add A Climax To This?

Now in order to ensure that you can successfully go ahead with this, ensure that HTML, Javascript and CSS are implemented appropriately, though you need not delve deeper into the technical side of the code.

Logging the URL

Logging the URL

Though we would not recommend jQuery as a compulsion, but adding it would make things easier. Start by downloading a version of jQuery from the jQuery_CDN – put it within the extension’s folder. Next download the latest minified version, jquery-2.1.3.min.js. If you have to load this, you will have to add manifest.json before ‘content.js’. And the entire manifest.json would appear something like:

{

 “manifest_version”: 2,

 “name”: “My Cool Extension”,

 “version”: “0.1”,

 “content_scripts”: [

   {

     “matches”: [

       “<all_urls>”

     ],

     “js”: [“jquery-2.1.3.min.js”, “content.js”]

   }

 ]

}

The Final Output

You have that little manifest.json file, along with the CSS, Javascript and HTML – which you can combine together and now each of the new tab that you open would appear a lot more interesting.

Step 4

Publishing Your Extension

Publishing your extension

So now you have a perfectly designed Chrome extension that is awesome and functions as expected. Then next, you can publish it to the Chrome store.

You can click on the link: https://chrome.google.com/webstore/developer/dashboard and go to the Chrome web store dashboard.

Click on the ‘Add new item’ button. Check the terms and then go to the page and here, you can upload your extension. Next step is to compress the folder with your project and upload the ZIP file.

Once you have successfully uploaded the file, the next you will see a form within which you can add information regarding your extension. Here, you can add icons, detailed descriptions, upload screenshots and much more. From the store, you can use these images to endorse an extension. By clicking on the ‘Preview Changes’ button within the ‘web store’, you can preview the appearance of your extension. If you are satisfied with the result, you can ‘Publish changes’.

In the Chrome Web Store, just type in the name of the extension by its title and find what you are looking for.

If you are looking for some help to create websites that stand out, then, we can help you. Acodez is a web design and web development company in India that helps in developing and designing websites that are based on the latest trends and ideas. 

Looking for a good team
for your next project?

Contact us and we'll give you a preliminary free consultation
on the web & mobile strategy that'd suit your needs best.

Contact Us Now!
Jamsheer K

Jamsheer K

Jamsheer K, is the Tech Lead at Acodez. With his rich and hands-on experience in various technologies, his writing normally comes from his research and experience in mobile & web application development niche.

Get a free quote!

Brief us your requirements & let's connect

Leave a Comment

Your email address will not be published. Required fields are marked *