Search code examples
javascripthtmlsvgfavicon

How to convert unicode character to svg and then a favicon


I want to convert this unicode character 📘 into svg format. Because I want to use it as a favicon. How do I simply do this?


Solution

  • One liner, set 👽 as favicon:

    document.head.appendChild(Object.assign(document.createElement("link"), {rel: "icon", href: "data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>👽</text></svg>"}))