Code Monkey home page Code Monkey logo

create-chrome-extension's Introduction

Create Chrome Browser Extensions

Hi! I am Aman Raj. This is a repository where you can learn how to make Chrome extensions easily.


Prerequisites


So before we start, let's discuss what are the types of Chrome extensions you can make :

  • Browser Action - Stays in tool bar; accesible all time.
  • Page Action - Stays in tool bar but grey-ed out. Accesible only on certain pages.
  • Neither Browser action nor Page action. Runs in background.

Extension components are created using these web development technologies :

  • Manifest ( JSON format )
  • HTML
  • CSS
  • JavaScript
  • Sometimes bootstrap and jQuery also.


These files combine to make a package of .crx format zip file which can be uploaded to Chrome web store.


Let's Begin

First, you have to create a manifest.json file. The directory holding the manifest file can be added as an extension in developer mode in its current state. This file should contain these 4 things :

  • "name" : tells you about the name of your extension.
  • "version" : tells you about the version of your Extension as you will publish changes later on in future.
  • "description" : this will be available in description section in Chrome web store.
  • "manifest_version" : Developers should specify which version of the manifest specification their package targets by setting a manifest_version key in their manifests.

manifest.json

{
    "name": "Hello World Extension",
    "version": "1.0",
    "description": "First Chrome extension",
    "manifest_version": 2
}

Secondly, create a popup.html file. This will give structure to your new static extension. You can add .css and .js file to make it beautiful and dynamic.

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Chrome Extension</title>
    <script src="popup.js"></script>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <h2 id="greet">Hi this is an extension</h2>
</body>
</html>

CSS

body {
    background: bisque;
}

h2 {
    color: brown;
}

So, we have created our first extension and now we want to see how it looks.

Let's see how to run this extension on Chrome.


Installation

  1. To test it, go to chrome://extensions.
  2. Enable Developer Mode by clicking the toggle switch next to Developer mode.
  3. Click the LOAD UNPACKED button and select the extension directory.

Congratulations! You have just created a basic Chrome extension. ๐ŸŽ‰๐ŸŽŠ

create-chrome-extension's People

Contributors

amanraj1608 avatar prateek-senapati avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.