Implementation
index.html
1<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>✌🏻</text></svg>">
favicon.js
1const favicon = document.querySelector('head > link[rel="icon"]');
2
3function faviconData(string, emoji) {
4 return `data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>${emoji}</text></svg>`.trim();
5}
6
7function setFavicon(emoji) {
8 favicon.setAttribute('href', faviconData`${emoji}`)
9}