Add Devtools Panels to your extension
mainTo add content to the browser developer tools, add a devtools_page entry to your manifest pointing to an HTML file.
- Manifest: Add
devtools_page: "src/entries/devtools/index.html". - Setup Script: Place a
devtools.jsfile in yourpublicdirectory to create the panel. - HTML: Load the
devtools.jsscript within your devtools HTML file.
Example public/devtools.js:
var _browser;
if (chrome) {
_browser = chrome;
} else {
_browser = browser;
}
_browser.devtools.panels.create(
"My Panel", // title
"images/icon-16.png", // icon
"src/entries/devtools/index.html" // content
);Example src/entries/devtools/index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Devtools</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="./main.ts"></script>
<script src="/devtools.js"></script>
</body>
</html>