You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: microsoft-edge/extensions-chromium/getting-started/part1-simple-extension.md
+40-22Lines changed: 40 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,20 +6,20 @@ ms.author: msedgedevrel
6
6
ms.topic: conceptual
7
7
ms.service: microsoft-edge
8
8
ms.subservice: extensions
9
-
ms.date: 01/10/2025
9
+
ms.date: 01/13/2025
10
10
---
11
11
# Sample: Display an image in a pop-up
12
12
13
13
This sample is a simple static extension, without JavaScript, that displays the `stars.jpeg` image in a small webpage in a pop-up in any Microsoft Edge tab:
<!-- for all extensions samples, this is the main copy to propagate copy/paste/modify. put comments on lines that vary per-sample -->
22
-
You can use various tools to clone a GitHub repo. You can download a selected directory, or clone the entire repo. These instructions use GitHub Desktop to clone the repo and switch to a working branch.<!-- future: doc git bash as the main way -->
22
+
You can use various tools to clone a GitHub repo. You can download a selected directory, or clone the entire repo. These instructions use GitHub Desktop to clone the repo and switch to a working branch.
23
23
24
24
To clone the `MicrosoftEdge-Extensions` repo to your local drive:
25
25
@@ -29,24 +29,41 @@ To clone the `MicrosoftEdge-Extensions` repo to your local drive:
29
29
30
30
1. Click the **Code** button, and then select **Open with GitHub Desktop**.
31
31
32
-
A dialog opens, saying **This site is trying to open GitHubDesktop.exe.**<!-- todo: update steps like part 2? -->
32
+
A dialog opens, saying **This site is trying to open GitHubDesktop.exe.**
33
33
34
34
1. Click the **Open** button.
35
35
36
36
GitHub Desktop opens, with the **MicrosoftEdge-Extensions** repo selected in the upper left dropdown list.
37
37
38
-
1. In GitHub Desktop, click the **Branch** menu, and then click **New branch**.
38
+
Or, in GitHub Desktop, the **Clone a repository** dialog opens:
39
+
40
+

41
+
42
+
1. Specify the local drive path to place the cloned repo directory into; for example: `C:\Users\accountname\GitHub\`.
43
+
44
+
1. Click the **Clone** button.
45
+
46
+
47
+
**Create working branch:**
48
+
49
+
1. In GitHub Desktop, make sure that in the upper left of GitHub desktop, **Current repository** is **MicrosoftEdge-Extensions**.
50
+
51
+
In the **Current branch** drop-down list, it says **main**.
52
+
53
+
1. In the **Current branch** drop-down list, click the **Branches** tab, and then click the **New branch** button.
39
54
40
55
The **Create a branch** dialog opens.
41
56
42
57
1. In the **Name** text box, enter a branch name, such as **ext-sample-1**, and then click the **Create branch** button.
43
58
44
59
In the upper middle and lower left of GitHub Desktop, the current branch is shown, such as **ext-sample-1**.
45
60
46
-
You are now free to modify the code in your working branch, without altering the code that's in the "main" branch of the repo.
61
+
You are now free to modify the code in your working branch, without altering the code that's in the "main" branch of the repo. Later you might want to switch back to the "main" branch, or create a different branch based off the "main" branch.
47
62
48
-
<!-- See also: -->
49
-
<!-- * [Step 2: Create a branch](https://docs.github.com/en/get-started/start-your-journey/hello-world#step-2-create-a-branch) in _Hello World_. -->
63
+
<!--
64
+
See also:
65
+
* [Step 2: Create a branch](https://docs.github.com/en/get-started/start-your-journey/hello-world#step-2-create-a-branch) in _Hello World_ in GitHub Docs.
1. Go to a webpage, such as [TODO app](https://microsoftedge.github.io/Demos/demo-to-do/)<!-- https://github.com/MicrosoftEdge/Demos/tree/main/demo-to-do -->, in a new window or tab. For this sample, this step is optional and is just to match the screenshots; this sample doesn't require a webpage to be open.
101
+
83
102
1. In the upper right of Microsoft Edge, click the **Extensions** () button. Or, select **Settings and more** (...) > **Extensions**.
84
103
85
104
The **Extensions** pop-up opens:
@@ -88,9 +107,9 @@ Instead of installing the sample from the Store, you'll install the sample local
88
107
89
108
1. Click the extension's icon or name (**NASA picture of the day pop-up**).
90
109
91
-
The extension opens, and the extension's icon is added next to the Address bar and Extensions () icon. The extension displays `popup.html`, containing `stars.jpeg`, in a pop-up:
110
+
The extension opens, and the extension's icon is added next to the Address bar and **Extensions** () icon. The extension displays `popup.html`, containing `stars.jpeg`, in a pop-up:
The `/icons/` directory is in the same directory as the manifest file, to store the icon image files. The icons are used as the background image for the button that you click to launch the extension:
184
+
The `/icons/` directory contains the icon image files. The icons are used as the background image for the button that you click to launch the extension:
166
185
167
-

186
+

187
+
<!-- ~~ -->
188
+
189
+
When the extension is running, one of the icons is displayed on the toolbar, next to the Address bar:
168
190
169
191

170
192
193
+
To close the extension, click the extension's icon on the toolbar, or click the **Extensions** () button.
194
+
171
195
Recommendations for icons:
172
196
* Use `PNG` format, but you can also use `BMP`, `GIF`, `ICO` or `JPEG` formats.
173
197
* If you provide a single icon file, use 128 x 128 px, which can be resized by the browser if necessary.
`popup.html` in the `popup` directory runs when you launch the extension. When you click the icon to launch the extension, this file is displayed as a modal dialog.
180
204
@@ -194,7 +218,9 @@ Recommendations for icons:
194
218
</html>
195
219
```
196
220
197
-
The popup (`popup.html`) is registered as the default popup in `manifest.json` under `action`:
221
+
The popup (`popup.html`) is registered as the `"default_popup"` in `manifest.json`, in the `action` key section:
222
+
223
+
`manifest.json` (portion)
198
224
199
225
```json
200
226
{
@@ -205,19 +231,11 @@ The popup (`popup.html`) is registered as the default popup in `manifest.json` u
To develop your own Microsoft Edge extension, you can copy and modify the sample's directory, and install and test the resulting extension.
220
-
<!-- todo: mention which branch you're in -->
221
239
222
240
After running and testing this extension sample, you can continue on to [Sample: Insert an image in the webpage](./part2-content-scripts.md), which dynamically inserts JavaScript running as content in the browser tab.
0 commit comments