Everybody knows how to setup a favicon.ico link in HTML:
<link rel="shortcut icon" href="http://hi.org/icon.ico" type="image/x-icon" />
favicon.ico by feeding it a data URI in the relevant
This technique avoids the extra http request and is confirmed to work in recent versions of Chrome, Firefox and Opera on Windows 7. However it doesn't appear to work in Internet Explorer 9 at least.
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <!-- Suppress browser request for favicon.ico --> <link rel="shortcut icon"type="image/x-icon" href="data:image/x-icon;,"> <script src="script.js"></script> ...
var favIcon = "\ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABrUlEQVR42mNkwAOepOgxMTD9mwhk\ [...truncated for brevity...] IALgNIBUQBUDAFi2whGNUZ3eAAAAAElFTkSuQmCC"; var docHead = document.getElementsByTagName('head'); var newLink = document.createElement('link'); newLink.rel = 'shortcut icon'; newLink.href = 'data:image/png;base64,'+favIcon; docHead.appendChild(newLink); /* Other JS would normally be in here too. */