Skip to content

Instantly share code, notes, and snippets.

@erikzrekz
Last active September 26, 2015 19:43
Show Gist options
  • Save erikzrekz/327426aa550a060fc9b7 to your computer and use it in GitHub Desktop.
Save erikzrekz/327426aa550a060fc9b7 to your computer and use it in GitHub Desktop.
///////////////////////////////////////////////////
// Source: http://marcel.turi.co/up/favicon.html //
///////////////////////////////////////////////////
var favIcon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABrUlEQVR42mNkwAOepOgxMTD9mwhk...";
var docHead = document.getElementsByTagName('head')[0];
var newLink = document.createElement('link');
newLink.rel = 'shortcut icon';
newLink.href = favIcon;
docHead.appendChild(newLink);
@erikzrekz
Copy link
Author

Steps to make a data:image/x-icon:

  1. If you have a svg, you can convert it to a png here - https://cloudconvert.com/svg-to-png
  2. If you have a png, you can convert it to a data url here - http://duri.me/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment