Skip to content

Commit

Permalink
docs: Add missing web_accessible_resources to injectScript example (
Browse files Browse the repository at this point in the history
  • Loading branch information
itsNikolay authored Jan 6, 2025
1 parent 654a54a commit 060e85f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/guide/essentials/content-scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,20 @@ export default defineContentScript({
});
```
```json
export default defineConfig({
manifest: {
// ...
web_accessible_resources: [
{
resources: ["example-main-world.js"],
matches: ["*://*/*"],
}
]
}
});
```
`injectScript` works by creating a `script` element on the page pointing to your script. This loads the script into the page's context so it runs in the main world.
`injectScript` returns a promise, that when resolved, means the script has been evaluated by the browser and you can start communicating with it.
Expand Down

0 comments on commit 060e85f

Please sign in to comment.