Microsoft Edge (Chromium) 扩展概述Overview of Microsoft Edge (Chromium) Extensions

扩展是你\(开发人员\)使用它来添加或修改 Microsoft Edge (Chromium) 功能的小程序。An extension is a small program that you (a developer) use to add or modify features for Microsoft Edge (Chromium). 扩展旨在改善用户的日常浏览体验。An extension is intended to improve a user's day-to-day browsing experience. 它提供了对目标受众很重要的功能。It provides niche functionality that is important to a target audience.

如果有基于以下任一条件的想法或产品,则可以创建扩展。You may create an extension if you have an idea or product that is based upon either of the following conditions.

  • 特定的 web 浏览器。A specific web browser.
  • 对特定网页功能的改进。Improvements to features of specific webpages.

配套体验的示例包括广告拦截器和密码管理器。Examples of companion experiences include ad blockers and password managers.

扩展的结构类似于常规 Web 应用。An extension is structured similar to a regular web app. 它至少应该包括以下功能。At a minimum, it should include the following features.

  • 包含基本平台信息的应用程序清单 JSON 文件。An app manifest JSON file that contains basic platform information.
  • 定义功能的 JavaScript 文件。A JavaScript file that define functionality.
  • 定义用户界面的 HTML 和 CSS 文件。HTML and CSS files that define the user interface.

若要直接使用部分浏览器(如窗口或选项卡),必须发送 API 请求,并通常按名称引用浏览器。To work directly with part of the browser, such as a window or tab, you must send API requests and often reference the browser by name.

Microsoft Edge (Chromium) 扩展

基本指南Basic guidance

为一些最受欢迎的浏览器包括 Safari、Firefox、Chrome、Opera、Cookie 和 Microsoft Edge 构建扩展。Some of the most popular browsers to build extensions for include Safari, Firefox, Chrome, Opera, Brave, and Microsoft Edge. 浏览器组织托管的网站是开始扩展开发教程和文档研究很好的位置。Great places to begin your extension development tutorials and documentation research are sites hosted by the browser organizations. 下表不确定的,可以作为起点。The following table isn't definitive, and may be used as a starting point.

Web 浏览器Web browser 基于 Chromium?Chromium-based? 扩展开发网页Extension development webpage
SafariSafari No
FirefoxFirefox No
镶边Chrome Yes
OperaOpera Yes
勇敢Brave Yes 使用 Chrome Web StoreUses Chrome Web Store
新 Microsoft Edgenew Microsoft Edge Yes


许多网站教程使用的浏览器特定的 API 可能与为其开发的浏览器不匹配。Many of the tutorials of the sites use browser-specific APIs that may not match the browser for which you develop. 在大多数情况下,Chromium 扩展在不同 Chromium 浏览器中工作,且 API 按预期工作。In most cases, a Chromium extension works as-is in different Chromium browsers and the APIs work as expected. 只有一些不太常见的 API 可能会严格特定于浏览器。Only some less common APIs may be strictly browser-specific. 有关教程的链接,请导航至“另请参见”。For links to the tutorials, navigate to See also.

为什么使用 Chromium?Why Chromium?

如果目标是在每个浏览器扩展应用商店中发布扩展,则必须为每个版本对其进行修改,以便在不同浏览器环境中运行。If your goal is to publish your extension in the extensions store for each browser, it must be modified for each version to target and run in each distinct browser environment. 例如,Safari 扩展可以同时使用 web 和本机代码与对应的本机应用通信。For example, Safari extensions may use both web and native code to communicate with counterpart native applications. 上表中的最后四个浏览器使用相同的代码包,并将维护并行版本的要求降到最低。The last four browsers in the previous table use the same code package, and minimizes the requirement to maintain parallel versions. 这些浏览器基于 [Chromium 开源项目][|::ref1::|Home]。These browsers are based on the [Chromium open-source project][|::ref1::|Home].

创建 Chromium 扩展以编写最少的代码。Create a Chromium extension to write the least amount of code. 它还以扩展应用商店的最大数量以及最终以找到和获取扩展的最大用户数为目标。It also targets the maximum number of extension stores and ultimately the maximum number of users who find and acquire your extension.

以下内容主要侧重于 Chromium 扩展。The following content focuses mostly on Chromium extensions.

浏览器兼容性和扩展测试Browser compatibility and extension testing

有时,Chromium 浏览器之间不存在 API 奇偶校验。Occasionally, API parity doesn't exist between Chromium browsers. 例如,标识和付款 API 存在差异。For example, there are differences in the identity and payment APIs. 为了确保扩展满足客户的期望,请通过以下官方浏览器文档查看 API 状态。To ensure your extension meets customer expectations, review API status through the following official browser docs.

所需 API 定义了为解决各浏览器之间差异而必须进行的更改。The APIs you require define the changes you must make to address the differences between each browser. 这可能意味着必须为每个应用商店创建略有差异的不同代码包。It may mean that you must create slightly different code packages with small differences for each store.

若要在将扩展提交到浏览器应用商店之前在不同环境中进行测试,请在开发扩展时将其旁加载到浏览器中。To test your extension in different environments before you submit it to a browser store, sideload it into your browser while you develop it.

将扩展发布到浏览器应用商店Publish your extension to browser stores

您可以在以下浏览器存储中提交和查找浏览器扩展。You may submit and seek browser extensions in the following browser stores.

某些商店允许你从其他浏览器下载列出的扩展。Some stores allow you to download listed extensions from other browsers. 但是,浏览器商店无法保证跨浏览器访问。However, cross-browser access is not guaranteed by browser stores. 为了确保你的用户可在不同的浏览器中找到扩展,应该在每个浏览器扩展商店上维护一个列表。To ensure your users find your extension in different browsers, you should maintain a listing on each browser extension store.

用户可能需要在不同的浏览器中安装扩展。Users may need to install your extension in different browsers. 在这种情况下,可以将现有的 Chromium 扩展从一个浏览器迁移到另一个浏览器。In this scenario, you may migrate existing Chromium extensions from one browser to another.

将现有扩展迁移到 Microsoft EdgeMigrate an existing extension to Microsoft Edge

如果已经为另一个 Chrome 浏览器开发了扩展,则可以将其提交到 Microsoft Edge 加载项商店。If you've already developed an extension for another Chromium browser, you may submit it to the Microsoft Edge Add-ons store. 不需要重写扩展,并且必须验证它在 MicrosoftEdge 中是否工作。You don't need to rewrite your extension, and must verify it works in Microsoft Edge. 将现有的 Chromium 扩展迁移到其他 Chromium 浏览器时,请确保相同的 API 或替代方案可用于该目标浏览器。When you migrate an existing Chromium extension to other Chromium browsers, ensure the same APIs or alternatives are available for your target browser.

有关将 Chrome 扩展移植到 Microsoft Edge 的更多信息,请导航到将 Chrome 扩展移植到 Microsoft Edge (Chrome)For more information on porting your Chrome extension to Microsoft Edge, navigate to Port Chrome extensions to Microsoft Edge (Chromium). 将扩展移植到目标浏览器后,下一步是发布它。After you port your extension to the target browser, the next step is to publish it.

发布到 Microsoft Edge 外接程序网站Publish to the Microsoft Edge add-ons website

若要开始将扩展发布到 Microsoft Edge,必须使用 MSA 电子邮件帐户注册开发人员帐户,才能将扩展列表提交到商店。To start publishing your extension to Microsoft Edge, you must register for a developer account with an MSA email account to submit your extension listing to the store. MSA 电子邮件帐户包括 等。An MSA email account includes,, and so on. 选择要注册的电子邮件地址时,请考虑是否必须与组织中其他人转移或共享扩展的所有权。When you choose an email address to register, consider if you must transfer or share ownership of the extension with others in your organization. 注册完成后,你可以向应用商店创建新的扩展提交。After registration is complete, you may create a new extension submission to the store.

若要向应用商店提交扩展,请确保提供以下项目。To submit your extension to the store, ensure you provide the following items.

  • 包含代码文件的存档 (.zip) 文件。An archive (.zip) file that contains your code files.
  • 所有必需的视觉资源,包括徽标和小型促销磁贴。All required visual assets, which include a logo and small promotional tile.
  • 可选促销媒体,如屏幕截图、促销贴片和视频 URL。Optional promotional media, such as screenshots, promotional tiles, and a video URL.
  • 描述扩展名的信息,如名称、简短描述和隐私策略链接。Information that describes your extension such as the name, short description, and a privacy policy link.


不同的应用商店可能具有不同的提交要求。Different stores may have different submission requirements. 上面的列表总结了发布 Microsoft Edge 扩展的要求。The above list summarizes the requirements to publish an extension for Microsoft Edge.

成功提交扩展后,扩展将经历审核过程,它将通过或不通过认证过程。After you've successfully submitted your extension, your extension undergoes a review process and either passes or fails the certification process. 向所有者通知结果,并按需要提供下一步步骤。Owners are notified of the outcome and given next steps as required. 如果向应用商店提交扩展更新,则会启动新的审阅过程。If you submit an extension update to the store, a new review process is started.

另请参阅See also