Favicon MV3 example (#721)

This commit is contained in:
Solomon Kinard
2022-08-10 09:38:13 -07:00
committed by GitHub
parent 4da98eada4
commit c2439aa243
3 changed files with 25 additions and 0 deletions

2
api/favicon/content.html Normal file
View File

@@ -0,0 +1,2 @@
<!DOCTYPE html>
<script src="content.js"></script>

6
api/favicon/content.js Normal file
View File

@@ -0,0 +1,6 @@
window.onload = e => {
const img = document.createElement('img');
const url = '_favicon/?page_url=https://www.google.com&size=64';
img.src = chrome.runtime.getURL(url);
document.body.appendChild(img);
}

17
api/favicon/manifest.json Normal file
View File

@@ -0,0 +1,17 @@
{
"name": "Favicon",
"version": "1",
"manifest_version": 3,
"permissions": ["favicon"],
"content_scripts": [{
"matches": ["<all_urls>"],
"js": ["content.js"],
"run_at": "document_idle"
}],
"web_accessible_resources": [{
"resources": [ "_favicon/*" ],
"matches": ["<all_urls>"],
"extension_ids": [ "*" ]
}],
"action": { "default_popup": "content.html" }
}