A Chrome Browser Plugin has a lot of different files and also the correct configuration is very important. To avoid pitfalls you can use the Extensionizr. Within 15 seconds you will get a functional Chrome extension!
Before we start just an overview “what is what…”.
Background pages defined by
An extension can have only one background page.
Choose a browser action when the extension is relevant to most pages.
If your extension needs to interact with web pages, then it needs a content script. Content scripts execute in their own isolated context, but they can access the DOM of the page. Content scripts can also communicate with other pages in your extension using a special message passing API.
Gives information about the extension
Choose a page action when the extension’s icon should be active or inactive (and grayed out), depending on the page.
You need a place to control the behavior of your extension, then you can use an option page.
More details could be found at:
Go to the website Extensionizr and select the following options. Please keep in mind that the content script will have the name “Inject.js” and not “content.js”.
Load the extension
Follow these steps to install your extension.
- Type chrome://extensions into your Chrome Browser
- Ensure that the Developer mode is checked.
- Click Load unpacked extension and select the directory.