d2296fac85
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 |
||
---|---|---|
.. | ||
README.md | ||
background.js | ||
manifest.json | ||
offscreen.html | ||
offscreen.js |
README.md
This recipe shows how to use DOMParser in an Extension Service Worker using the Offscreen document.
Context
Extension Service Workers don't have direct access to the DOM. This example demonstrates how to use an offscreen document for parsing and modifying DOM from an Extension Service Worker. Offscreen documents and Extension Service Workers exchange data using message passing.
Running this extension
- Clone this repository.
- Load this directory in Chrome as an unpacked extension.
- Open the Extension menu and click the extension named "Offscreen API - DOM Parsing".
If you inspect the Extension Service Worker in Chrome DevTools, you can see the result of the DOM transformation in the console view.