mirror of
https://github.com/GoogleChrome/chrome-extensions-samples.git
synced 2026-03-27 13:29:34 +07:00
Favicon MV3 example (#721)
This commit is contained in:
2
api/favicon/content.html
Normal file
2
api/favicon/content.html
Normal file
@@ -0,0 +1,2 @@
|
||||
<!DOCTYPE html>
|
||||
<script src="content.js"></script>
|
||||
6
api/favicon/content.js
Normal file
6
api/favicon/content.js
Normal 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
17
api/favicon/manifest.json
Normal 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" }
|
||||
}
|
||||
Reference in New Issue
Block a user