diff --git a/microsoft-edge/extensions/developer-guide/devtools-extension-images/overall_screenshot_mv3.png b/microsoft-edge/extensions/developer-guide/devtools-extension-images/architecture.png similarity index 100% rename from microsoft-edge/extensions/developer-guide/devtools-extension-images/overall_screenshot_mv3.png rename to microsoft-edge/extensions/developer-guide/devtools-extension-images/architecture.png diff --git a/microsoft-edge/extensions/developer-guide/devtools-extension-images/custom-tab-activity-bar.png b/microsoft-edge/extensions/developer-guide/devtools-extension-images/custom-tab-activity-bar.png new file mode 100644 index 0000000000..81b2a7b1d9 Binary files /dev/null and b/microsoft-edge/extensions/developer-guide/devtools-extension-images/custom-tab-activity-bar.png differ diff --git a/microsoft-edge/extensions/developer-guide/devtools-extension-images/devtools-extension-show-greeting.png b/microsoft-edge/extensions/developer-guide/devtools-extension-images/devtools-extension-show-greeting.png deleted file mode 100644 index 31faa3a563..0000000000 Binary files a/microsoft-edge/extensions/developer-guide/devtools-extension-images/devtools-extension-show-greeting.png and /dev/null differ diff --git a/microsoft-edge/extensions/developer-guide/devtools-extension-images/devtools-extension-show-position-in-console.png b/microsoft-edge/extensions/developer-guide/devtools-extension-images/devtools-extension-show-position-in-console.png deleted file mode 100644 index af74fde60d..0000000000 Binary files a/microsoft-edge/extensions/developer-guide/devtools-extension-images/devtools-extension-show-position-in-console.png and /dev/null differ diff --git a/microsoft-edge/extensions/developer-guide/devtools-extension-images/devtools-extension-show-position.png b/microsoft-edge/extensions/developer-guide/devtools-extension-images/devtools-extension-show-position.png deleted file mode 100644 index 826bc55a51..0000000000 Binary files a/microsoft-edge/extensions/developer-guide/devtools-extension-images/devtools-extension-show-position.png and /dev/null differ diff --git a/microsoft-edge/extensions/developer-guide/devtools-extension-images/devtools-extension-with-memory-info.png b/microsoft-edge/extensions/developer-guide/devtools-extension-images/devtools-extension-with-memory-info.png deleted file mode 100644 index 9fb4391a2a..0000000000 Binary files a/microsoft-edge/extensions/developer-guide/devtools-extension-images/devtools-extension-with-memory-info.png and /dev/null differ diff --git a/microsoft-edge/extensions/developer-guide/devtools-extension-images/devtools-extension-with-panel.png b/microsoft-edge/extensions/developer-guide/devtools-extension-images/devtools-extension-with-panel.png deleted file mode 100644 index 9c18e9be67..0000000000 Binary files a/microsoft-edge/extensions/developer-guide/devtools-extension-images/devtools-extension-with-panel.png and /dev/null differ diff --git a/microsoft-edge/extensions/developer-guide/devtools-extension-images/devtools-main-toolbar-tabs.png b/microsoft-edge/extensions/developer-guide/devtools-extension-images/devtools-main-toolbar-tabs.png deleted file mode 100644 index fa4ea0a873..0000000000 Binary files a/microsoft-edge/extensions/developer-guide/devtools-extension-images/devtools-main-toolbar-tabs.png and /dev/null differ diff --git a/microsoft-edge/extensions/developer-guide/devtools-extension-images/edge-extensions-page-reload-button.png b/microsoft-edge/extensions/developer-guide/devtools-extension-images/edge-extensions-page-reload-button.png deleted file mode 100644 index 659cfed9d2..0000000000 Binary files a/microsoft-edge/extensions/developer-guide/devtools-extension-images/edge-extensions-page-reload-button.png and /dev/null differ diff --git a/microsoft-edge/extensions/developer-guide/devtools-extension-images/edge-extensions-page.png b/microsoft-edge/extensions/developer-guide/devtools-extension-images/edge-extensions-page.png deleted file mode 100644 index 2249ad9b1c..0000000000 Binary files a/microsoft-edge/extensions/developer-guide/devtools-extension-images/edge-extensions-page.png and /dev/null differ diff --git a/microsoft-edge/extensions/developer-guide/devtools-extension-images/solution-sample-panel.png b/microsoft-edge/extensions/developer-guide/devtools-extension-images/solution-sample-panel.png deleted file mode 100644 index a7bef75d8f..0000000000 Binary files a/microsoft-edge/extensions/developer-guide/devtools-extension-images/solution-sample-panel.png and /dev/null differ diff --git a/microsoft-edge/extensions/developer-guide/devtools-extension.md b/microsoft-edge/extensions/developer-guide/devtools-extension.md index fcabfac479..816e4f80a9 100644 --- a/microsoft-edge/extensions/developer-guide/devtools-extension.md +++ b/microsoft-edge/extensions/developer-guide/devtools-extension.md @@ -1,374 +1,74 @@ --- title: Create a DevTools extension, adding a custom tool tab and panel -description: In this tutorial, you learn to build a Microsoft Edge extension that extends DevTools. At the end of the tutorial, you should have a working DevTools extension that creates its own panel and interacts with the DevTools extension APIs. +description: Build a Microsoft Edge extension that adds a custom tool in DevTools, including a tool tab and panel. Communicate between DevTools and the inspected webpage, and call DevTools APIs. author: MSEdgeTeam ms.author: msedgedevrel ms.topic: conceptual ms.service: microsoft-edge ms.subservice: extensions -ms.date: 11/18/2024 +ms.date: 10/27/2025 --- # Create a DevTools extension, adding a custom tool tab and panel + + -This article provides a sample and code walkthrough for a Microsoft Edge extension that adds a tool tab and panel in DevTools. +todo: strategy: first get familiar with the sample's code: purpose of the 8 files: +1. move all info about specific files to the Code article +2. arrange all info into a nice format in the Code article +3. design the Background article, after understand the code -This article first shows how to install and run the provided DevTools extension sample, which adds a **Sample Panel** tool tab in DevTools within Microsoft Edge. The sample is a working DevTools extension that creates its own panel, and interacts with the DevTools APIs. +To add a custom tool in Microsoft Edge DevTools, create a Microsoft Edge extension. -This article then presents a tutorial that shows how you can optionally create that sample from scratch, and explains each step of developing the sample, and how the added code works. These tutorial steps are a good way to experience everything that's needed for typical development. +The DevTools Extension sample displays a custom tool in DevTools, including a **Custom** tab in the **Activity Bar** and a panel connected to the tab: -See also: -* [Overview of DevTools](../../devtools/overview.md) - - - -## Download, install, and run the DevTools extension sample - -To download, install, run, and test the provided, finished DevTools extension sample: - -1. Download the final extension code by clicking [Demos-main.zip](https://codeload.github.com/MicrosoftEdge/Demos/zip/refs/heads/main) and then extracting its content to a folder on your computer. - -1. Open Microsoft Edge and go to `edge://extensions/`. - -1. Turn on the **Developer mode** toggle. - -1. Click **Load unpacked** and navigate to the folder where you extracted the zip file. In this folder, select **Demos-main** > **devtools-extension** > **sample 4**, and then click **Select Folder**. - - ![The edge://extensions page in Microsoft Edge, showing the Developer mode and Load unpacked buttons](./devtools-extension-images/edge-extensions-page.png) - - The DevTools extension is loaded. - -1. In Microsoft Edge, open a new tab. - -1. Open DevTools (**F12**). - -1. Select the **Sample Panel** tool (tab). - - The **Sample Panel** tool opens: - - ![Microsoft Edge, showing DevTools on the side, with the extension's Sample Panel selected](./devtools-extension-images/solution-sample-panel.png) - -1. Click the **Say Hello to the inspected page** button. - - An alert is displayed in the inspected page: - - ![Microsoft Edge, showing the new extension panel in DevTools on the side, and an alert dialog window](./devtools-extension-images/devtools-extension-show-greeting.png) +![Custom tab](./devtools-extension-images/custom-tab-activity-bar.png) -1. Click the **OK** button to close the alert. +A basic extension for Microsoft Edge consists of a manifest file (`manifest.json`). -1. Click anywhere in the inspected page. +An extension that extends DevTools additionally includes a webpage file, `devtools.html`, that just loads `devtools.js` - A message is displayed in the extension panel: **You clicked on position (199, 509) in the inspected page**: +A _panel_ is a tool page in Microsoft Edge DevTools, along with the tool's tab in the **Activity Bar**. - ![The sample panel in DevTools showing the clicked position message](./devtools-extension-images/devtools-extension-show-position.png) +To create a basic DevTools extension with a sample panel; to create a new panel (tool tab) in DevTools, by adding `devtools.js` and `panel.html`. -1. Select the **Console** tool. - - A message appears in the **Console** tool: **Received response > _{xPosition: 199, yPosition: 509}_**: - - ![The DevTools Console tool showing the clicked position message](./devtools-extension-images/devtools-extension-show-position-in-console.png) - -You downloaded, installed, ran, and tested the provided, finished DevTools extension sample. In the next steps, you create the same sample by starting from an empty directory. The following sections explain how the code works. - - - -## Step 1: Create a basic Microsoft Edge extension that has a DevTools webpage - -If you want to create the files for each major step below, install a code editor such as [Visual Studio Code](https://code.visualstudio.com/), to follow the tutorial steps below to manually re-create the above sample DevTools extension. You can read the code walkthrough below, presented as four major steps or phases. - -A basic extension for Microsoft Edge consists of a manifest file (`manifest.json`). Because this particular extension extends DevTools, this extension also includes a webpage file, `devtools.html`. The two files are provided in the `Microsoft Edge / Demos` repo > [/devtools-extension/sample 1/](https://github.com/MicrosoftEdge/Demos/tree/main/devtools-extension/sample%201) directory. The directory contains the files: +That's in addition to the more basic files, which are: * `devtools.html` * `manifest.json` - - -#### manifest.json - -`manifest.json` is a manifest file, containing key/value pairs. The top-level keys are called _members_: - -```json -{ - "name": "DevTools Sample Extension", - "description": "A Basic DevTools Extension", - "manifest_version": 3, - "version": "1.0", - "devtools_page": "devtools.html" -} -``` - -| Member | Description | -|----------|-------------| -| `name` | The name of the extension that will appear under `edge://extensions/`. | -| `description` | The description of the extension that will be displayed under the name of the extension. | -| `version` | The version of the extension that will appear next to the name of the extension. | -| `manifest_version` | Determines the set of features that the extension will be using, such as service workers or network request modification. The current version is version `3`. To learn more about this version and the differences with version `2`, see [Overview and timelines for migrating to Manifest V3](./manifest-v3.md). | -| `devtools_page` | The path to an HTML file that's run every time DevTools is opened, and loads the extension's JavaScript files. This page isn't rendered in DevTools. | - - - -#### devtools.html - -`devtools.html` matches the `devtools_page` member in the manifest file: - -```html - - - - - - - A Basic DevTools Extension. - - -``` - -In a later step, you'll add a ` - - - ``` - - In the manifest file (`manifest.json`), the `devtools_page` field specifies the above file (`devtools.html`). `devtools.html`, above, contains a ` + + +``` + +In the manifest file (`manifest.json`), the `devtools_page` field specifies the above file (`devtools.html`). `devtools.html`, above, contains a `