Study Notes on chrome plug-in development (1)

Source: Internet
Author: User

Chrome plugin Guide

Summary

-An extension is a zipped bundle of files-HTML, CSS, JS, images, and anything else you need.

-Extensions are essential web pages, and they can use all the APIs that the browser provides

-Extends extensions add UI to chrome in the form of browser actions or page actions.

-Extensions can also interact programmatically with browser such as bookmarks and tabs.

-To interact with web pages or servers, extensions can use content scripts or cross-origin xmlhttprequests.

1. Choose a browser action when the extension is relevant to most pages.

2. Choose a page action when the extension's icon shocould appear or disappear

-Each extensions has the following files:

1. a manifest File

2. One or more HTML files

3. [Optional] one or more JavaScript files

4. [Optional] Any other your extensions need, like images files

-When distribute extension, the contents of the folder are packaged into a special ZIP file that has a. CRX suffix.

-You can refer to the file in your extension by relative URL. every file in an extension is also accessible by an absolute URL like this: chrome-Extension: // <extensionid>/<pathtofile>

-Extensionid is a unique identifier that the extension system generates for each extension.

 

Manifest File

-The manifest file, called manifest. JSON, gives information about the extension, such as the most important files and the capabilities that the extension might use.

 

Content scripts

-A content script is some JavaScript that executes in the contect of a page that's been loaded into the browser. think of a content script as part of that loaded page, not as part of the extension

-Content scripts can read details of the web pages the browser visits, and they can make change to the page. (modify the dom for the displayed web page, but cann't modify the background page)

-A content script can exchange messages with its parent extension.

Communicaiton between pages

-The HTML pages with in an extension often need to communicate. because all of an extension's pages execute in same process on the same thread, the pages can make direct function callto each other.

-Incognito mode promises that the window will leave no tracks. When dealing with data from incognito windows, do your best to honor this promise. (check tab. incognito Property)

 

 

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.