Getting Started with chrome Extensions 2. How do I use the chrome Extensions API?

Source: Internet
Author: User
Tags documentation

Getting Started with chrome Extensions 2. How to use the Chrome Extensions API.

Google's Chrome Extensions API is one of the most authoritative materials for developing chrome extensions, detailing the features that Chrome extensions can achieve and the interfaces that Chrome offers (such as how to invoke user bookmarks). This article describes how to develop a document using Chrome extensions. What a seemingly complete chrome extension has.

Amount: Good around the title ... is actually what the chrome extension looks like: (Still quite round ...) )

1. Plugin bar icon (optional):

These icons are all ~ ~

2, plug-in bar pop-up page (optional)

Plug-in bar icon is clickable, left click will pop up a small page, the page shows what is completely controlled by the developer, right click Will pop up a menu, this is not the Chrome extension can control

3. Extended Admin page icon (optional)

The icon displayed on the Extended Administration page. This icon matches the icon shown when installing the plugin, but it is set separately from the plugin bar icon.

If you do not define this icon, the extension is installed just like this ...

4. Options page (plugin settings page, optional)

If your plugin contains a settings page, you will see the "Options" link on the Extended Administration page

5. New tab page

By default, when you create a new blank label, the most recently viewed Web site and recently closed tags are displayed.

This page can be modified by extension. There have been some extensions to change this page to a task list, a common website, and so on.

6. Small icons that are selectively displayed for different pages

For example, this icon can be displayed only when a particular page is loaded

The icon for an extension bar cannot be displayed/hidden by program control.

The above mentioned in the API documentation is the browser UI section

The Chrome Browser provides those interfaces for the extension.

1. Bookmarks

The Chrome extension makes it easy to get the user's bookmark data, including the bookmark ID, address, title, or even the directory that belongs to it. also provides interfaces for adding, modifying, deleting, and searching.

2. Historical records

Chrome extensions can add, delete (all, follow a specific URL, etc.), search for a user's history, and more.

3. Browser tab page

The Chrome extension can get tabs that are open by the current User, Monitor tab status (created, loaded, loaded, removed, and so on), create tabs, and Remove tabs. You can also inject CSS on a specific tab (that is, add a new CSS to the page), execute the JS code (equivalent to the introduction of a JS file in the page, you can share the page JS variable)

4. browser window

A window can contain multiple tabs. Developers can create, remove, update a window, or watch a window action (created). State changes. Be closed. )

These are the browser interaction parts of the API documentation where my code is written. Where to execute.

It says that the chrome extension is just a few pages, so the code is, of course, the JavaScript of the web. The Chrome browser cleverly designs a few special pages that developers can use to implement many of the features of the JS code in these pages.

1. Backstage page (Background pages)

JS in the background HTML starts when the browser is opened and stops working when the browser is closed. You can write some code here to monitor the browser action (such as when the user created a new tab when the evil turn it off ^_^), can do timed tasks (setinterval, etc.), you can add a piece of music ... However, this page is not visible to the body user.

2. Pop-up page of the extension bar icon

When the user clicks the extension bar icon, a page pops up and the page is closed when the user clicks on the page section. This is a complete Web page, where you can put video, animation, function buttons and so on.

3, embedded in the Web page JS (Content Scripts)

You can use JS to get the user's current Web page DOM data, listening to user keyboard, mouse action. The code is a standalone JS file (rather than the embedded JS code in an HTML file, such as a background, popup, etc.), which is injected into the appropriate Web page via an extended configuration.

4. Read user computer data (NPAPI Plugins)

This function to use the DLL (dynamic link library) knowledge, you can start the user's computer program, delete user files and other functions. Equivalent to a small Windows program. Use the method provided by Chrome to let the extended background page communicate with your DLL.

These are the implementation sections in the API documentation.

Automatic Updates

Autoupdating part is to tell you how Chrome extensions are automatically upgraded

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.