Skip to content

Developing Google Chrome Extensions Notes

January 30, 2011

Typical Google Chrome Extensions are made from the same kinds of files you would see in your average web page: HTML, CSS, PNG, Javascript. Another kind of extension is a Packaged App (*.crx) which can not have a brower action or page action. Instead, at least one HTML file must be provided to serve as the UI.
A special manifest.json file contains metadata about the main entry points of your extension.
There are several ways Google Chrome can present a UI for your extension.
Browser Actions are icons that appear next to the address bar.
Page Actions are icons that appear inside the address bar.
Standalone page in the case of Packaged Apps.
For security and stability reasons, the only way access to the current page’s DOM is limited to:
1. content-scripts
2. TAB Api: ExecuteScript method.
Background.html is a special file that contains privileged code that remains active throughout the life of your extension.
To communicate between your extension (background.html) and the unprivileged code (content-scripts, popup page) you will to use message passing.
To use jQuery in your html pages you can just include it. To use jQuery in content-scripts you must include it in your manifest.json file (content_scripts[‘js’]).
You can control where your extension is active using the “permissions” field of the manifest.json.
You can control where your content-scripts will be injected using the content_scripts[‘matches’] field.

From → Web Development

Leave a Comment

Leave a comment