Files
Oliver Dunk d2296fac85 Update dependencies (#1096)
Updates a nunber of dependencies in a single PR. These were
suggested by dependabot but updating them individually would
mean the reposistory would be in a broken state until everything
had merged.

I'm not personally a huge fan of lowercasing doctype, but
Prettier has taken an opinionated stance here and there is not a
way to disable it:

https://github.com/prettier/prettier/issues/15096
2024-02-20 12:53:23 +01:00
..
2024-02-20 12:53:23 +01:00

chrome.scripting API

This sample demonstrates using the chrome.scripting API to inject JavaScript into web pages.

Overview

Once this extension is installed, clicking this extension's action icon will open an extension page.

Screenshot showing the chrome.scripting API demo running in Chrome.

Features

This sample allows you to experiment with the following injection mechanisms:

Learn more at https://developer.chrome.com/docs/extensions/mv3/content_scripts/.

Implementation Notes

Programmatic injection is handled in the service worker. A tab is opened to a specific URL (https://example.com/#inject-programmatic). When the page finishes loading, a script is then run using chrome.scripting.executeScript.

When registering a dynamic content script, a tab is automatically opened if using the default matches URL. Otherwise, no tab is opened and the correct URL needs to be manually navigated to.