Skip to content

Commit

Permalink
Update web accessible resource samples to use dynamic URLs (#1317)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbenz authored Oct 8, 2024
1 parent edf9779 commit 8dcd06d
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 4 deletions.
32 changes: 32 additions & 0 deletions api-samples/web-accessible-resources/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ <h1>Web Accessible Resources Demo</h1>
to build the image's URL at runtime.
</p>

<p>
The third example shows the second website again, but this time using the
`use_dynamic_urls` flag which only allows resources to be accessed through
a dynamic ID. The id is regenerated when the browser restarts or the
extension reloads.
</p>

<table>
<thead>
<tr>
Expand Down Expand Up @@ -92,6 +99,20 @@ <h1>Web Accessible Resources Demo</h1>
<td>web-accessible-resources-2.glitch.me</td>
<td>Dynamically injected</td>
</tr>
<tr>
<td>
<code><a href="test3.png">test3.png</a></code>
</td>
<td>web-accessible-resources-3.glitch.me</td>
<td>Statically referenced with <code>use_dynamic_url</code></td>
</tr>
<tr>
<td>
<code><a href="test4.png">test4.png</a></code>
</td>
<td>web-accessible-resources-3.glitch.me</td>
<td>Dynamically injected with <code>use_dynamic_url</code></td>
</tr>
</tbody>
</table>

Expand Down Expand Up @@ -119,5 +140,16 @@ <h1>Web Accessible Resources Demo</h1>
height="200"
></iframe>
</figure>
<figure>
<figcaption>
https://web-accessible-resources-3.glitch.me/ can access image
<a href="test4.png"><code>test4.png</code></a>
</figcaption>
<iframe
src="https://web-accessible-resources-3.glitch.me/"
width="100%"
height="200"
></iframe>
</figure>
</body>
</html>
9 changes: 7 additions & 2 deletions api-samples/web-accessible-resources/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
{
"matches": [
"https://web-accessible-resources-1.glitch.me/*",
"https://web-accessible-resources-2.glitch.me/*"
"https://web-accessible-resources-2.glitch.me/*",
"https://web-accessible-resources-3.glitch.me/*"
],
"all_frames": true,
"js": ["content-script.js"]
Expand All @@ -24,7 +25,11 @@
},
{
"resources": ["test3.png", "test4.png"],
"matches": ["https://web-accessible-resources-2.glitch.me/*"],
"matches": ["https://web-accessible-resources-2.glitch.me/*"]
},
{
"resources": ["test3.png", "test4.png"],
"matches": ["https://web-accessible-resources-3.glitch.me/*"],
"use_dynamic_url": true
}
],
Expand Down
3 changes: 2 additions & 1 deletion functional-samples/sample.favicon-cs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"web_accessible_resources": [
{
"resources": ["_favicon/*"],
"matches": ["<all_urls>"]
"matches": ["<all_urls>"],
"use_dynamic_url": true
}
]
}
3 changes: 2 additions & 1 deletion functional-samples/tutorial.custom-cursor/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"web_accessible_resources": [
{
"resources": ["dino.png", "dino-pointer.png"],
"matches": ["https://developer.chrome.com/*"]
"matches": ["https://developer.chrome.com/*"],
"use_dynamic_urls": true
}
],
"permissions": ["storage"],
Expand Down

0 comments on commit 8dcd06d

Please sign in to comment.