1
2
3
4
5
6
7
8
9
10
11
// SPDX-License-Identifier: 0BSD
const GOOGLE_FAVICONS_BASE_URL = "https://www.google.com/s2/favicons";
export function createFaviconURL(url: string | URL, size = 16): URL {
const { hostname } = new URL(url);
const faviconURL = new URL(GOOGLE_FAVICONS_BASE_URL);
faviconURL.searchParams.set("domain", hostname);
faviconURL.searchParams.set("sz", `${size}`);
return faviconURL;
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
March 6, 2024