Skip to content

Commit

Permalink
Fix favicon API example (GoogleChrome#771)
Browse files Browse the repository at this point in the history
  • Loading branch information
hut8 authored Dec 8, 2022
1 parent 2938c52 commit 5c41102
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions api/favicon/content.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
function faviconURL(u) {
const url = new URL(chrome.runtime.getURL("/_favicon/"));
url.searchParams.set("pageUrl", u); // this encodes the URL as well
url.searchParams.set("size", "64");
return url.toString();
}

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);
img.src = faviconURL("https://google.com");
document.body.appendChild(img);
}

0 comments on commit 5c41102

Please sign in to comment.