If you follow along, by the end of this post you’ll have a working Chrome extension.
One of the great things about web programming is that the parts are in a standard structure. Because of this standard structure, it’s possible to modify other people’s programs. This client side modification is usually done with user scripts.
There are various reasons why you might want to create an extension. For example, you could make an extension to:
- Improve your browsers general functionality to be more powerful and useful
- Make a specific site more useful
- Circumvent poor security
- Automate something
This post will show you how to get started with Chrome extensions, however you can do similar things in other browsers, for example in Firefox has grease monkey plugins.
Create a directory. Everything your extension needs will go into this directory.
Create a file in the directory called manifest.json with these contents:
Create and copy in an icon named icon.png
Create a file called background.js with these contents:
Open Chrome, click the spanner, extensions, click developer mode.
Click ‘load unpacked extension’, find your folder and click ok.
That’s it, your extension is done. Your code will load when Chrome starts, a button will show up next to the navigation bar, and the onClicked event will fire when your button is clicked.