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 Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: