At a high level, we'll use it to declare to Chrome what the extension is going to do, and what permissions it requires in order to do those things.
Many extensions have a background page, an invisible page that holds the main logic of the extension. An extension can also contain other pages that present the extension's UI. If an extension needs to interact with web pages that the user loads (as opposed to pages that are included in the extension), then the extension must use a content script.
There are two types of background pages: persistent background pages, and event pages. Persistent background pages, as the name suggests, are always open. Event pages are opened and closed as needed. Unless you absolutely need your background page to run all the time, prefer to use an event page.
The HTML pages inside an extension have complete access to each other's DOMs, and they can invoke functions on each other.
If your extension needs to interact with web pages, then it needs a content script. A content script is some JavaScript that executes in the context 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 it was packaged with (its parent extension).
Content scripts can read details of the web pages the browser visits, and they can make changes to the pages.
In the following figure, the content script can read and modify the DOM for the displayed web page. It cannot, however, modify the DOM of its parent extension's background page.
Content scripts aren't completely cut off from their parent extensions. A content script can exchange messages with its parent extension, as the arrows in the following figure show. For example, a content script might send a message whenever it finds an RSS feed in a browser page. Or a background page might send a message asking a content script to change the appearance of its browser page.
In addition to having access to all the APIs that web pages and apps can use, extensions can also use Chrome-only APIs (often called chrome.* APIs) that allow tight integration with the browser. For example, any extension or web app can use the standard window.open() method to open a URL. But if you want to specify which window that URL should be displayed in, your extension can use the Chrome-only tabs.create method instead.
The HTML pages within 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.
分享到:
相关推荐
Chrome扩展(Chrome插件)是谷歌浏览器上的应用程序,它们能够增强和定制用户的浏览体验。这些插件是由HTML、CSS...通过学习官方文档(如chrome_doc),开发者可以深入理解这些概念并创建出满足用户需求的高质量插件。
Chrome浏览器插件Axure Chrome Extension是一款专为Axure RP设计的工具,旨在增强Axure原型在Chrome浏览器中的体验。Axure RP是一款广泛使用的交互原型设计软件,它允许设计师快速创建 wireframes、prototypes 和 ...
对于Axure Chrome Extension V0.6.3,用户应从官方渠道下载,以保障数据安全和隐私。 综上所述,Axure Chrome Extension V0.6.3 是一款旨在提升Axure原型设计流程效率和协作体验的工具,通过浏览器内的即时预览和...
Axure Chrome Extension是一款专为Axure设计的浏览器插件,它极大地扩展了Axure原型在谷歌浏览器中的功能,使得交互设计师和产品经理能够更便捷地在浏览器中预览、测试和分享他们的原型作品。这款插件的使用对于提高...
如果你在用谷歌浏览器打开Axure生成的本地HTML文件时,提示安装扩展程序Axure RP Extension for Chrome,但是按照中文网提供的安装方法,在最新版的谷歌浏览器中已经无法安装成功。会提示:程序包无效:“CRX_HEADER...
OpenAI Translator Chrome Extension是一个Chrome浏览器扩展程序,它可以利用OpenAI的语言模型进行多语言翻译。用户只需要选中需要翻译的文本,然后点击扩展程序图标即可获得快速准确的翻译结果。该扩展程序可用于...
"原型图插件 axure-chrome-extension-V0.6.3"是针对谷歌浏览器(Chrome)的一个扩展,旨在帮助用户更方便地查看和测试Axure制作的原型设计。 首先,让我们深入了解一下Axure。Axure RP(Rapid Prototyping)是一个...
Axure Chrome Extension V0.6.3 是一个专为网页原型设计工具Axure设计的浏览器扩展,它极大地提升了用户在Chrome浏览器中预览和编辑Axure RP项目时的效率和便利性。本教程将详细介绍该插件的功能以及如何进行安装。 ...
Axure导出的html文件在浏览器中打不开,是因为浏览器缺少“axure-chrome-extension”插件导致。只需要在扩展程序中安装一个插件“axure-chrome-extension”,就可以解决问题了。
这篇博客文章主要讲解了如何利用Chrome扩展(Extension)功能,创建一个实用的工具,允许用户在浏览网页时方便地选取文本并进行笔记记录。Chrome扩展是一种JavaScript、HTML和CSS的集合,它们能够与浏览器交互,增强...
标题中的“谷歌扩展程序之axure-chrome-extension.zip”指的是一个专门为谷歌浏览器(Chrome)设计的扩展程序,这个扩展程序的名称是“Axure Chrome Extension”。Axure是一款流行的产品原型设计工具,它允许设计师...
"chrome-extension-network.zip" 是一个包含示例代码的压缩包,专门针对Chrome扩展中的网络模块,旨在帮助开发者理解和实践如何利用网络接口进行各种网络操作。在本篇文章中,我们将深入探讨Chrome扩展的网络模块...
Axure RP Extension for Chrome是原型设计工具Axure RP的Chrome浏览器插件。因为在线安装需要访问Google Chrome在线商店,访问不了。所以提供一个离线版本进行安装。 安装方法: 1、打开Chrome浏览器,找到“工具 ->...
1. 下载并解压axure_chrome_extension_V0.6.3压缩包。 2. 打开Chrome浏览器,进入设置页面,找到“更多工具”>“扩展程序”。 3. 开启开发者模式,然后点击“加载已解压的扩展程序”,选择之前解压的文件夹路径。 4....
Axure Chrome Extension是一款专为网页原型设计工具Axure RP设计的浏览器扩展,它极大地提升了Axure原型在Chrome浏览器中的预览和协作效率。这款插件允许用户直接在Chrome浏览器中查看和测试Axure RP创建的原型,...
安装过程中,可能需要开启Chrome的“开发者模式”,因为官方应用商店可能不包含所有第三方插件。 使用这款插件,用户可以实现以下功能: 1. 直接在浏览器中预览Axure原型,无需切换到其他应用程序。 2. 快速分享...