Chrome插件开发学习笔记(一)
2010-07-15 23:55
513 查看
Chrome Plugin Guide
Summary
- An extension is a zipped bundle of files – HTML, CSS, JS, images, and anything else you need.
- Extensions are essentially web pages, and they can use all the APIs that the browser provides
- Many 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 should 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 calls to 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)
Summary
- An extension is a zipped bundle of files – HTML, CSS, JS, images, and anything else you need.
- Extensions are essentially web pages, and they can use all the APIs that the browser provides
- Many 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 should 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 calls to 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)
相关文章推荐
- Chrome插件开发学习笔记(二)
- Chrome插件开发笔记
- Chrome插件开发学习心得(三)之传值
- python3.4学习笔记(五) IDLE显示行号问题,插件安装和其他开发工具介绍
- Eclipse插件开发 学习笔记 PDF 第一篇到第四篇 免分下载 开发基础 核心技术 高级进阶 综合实例
- chrome app 学习笔记 (1) --开发简介
- jquery插件开发学习笔记(四)——导航栏特效
- Chrome扩展,应用开发学习笔记之2---恶搞百度一下
- Java-Eclipse插件开发学习笔记
- VS插件开发学习笔记:VS2008所有菜单名字
- 插件开发学习笔记
- Chrome插件开发学习——开发入门
- jQuery插件开发 学习笔记
- Jquery插件按开发学习笔记(一)
- jquery插件开发学习笔记(一)
- Chrome插件开发学习心得(五)之注入脚本
- Chrome插件开发学习——开发进阶
- openfire 插件开发学习笔记
- Chrome扩展,应用开发学习笔记之2---恶搞百度一下
- Chrome扩展开发学习笔记之扩展基础