Created
August 14, 2015 11:53
-
-
Save srinathweb/d1ec3a2fa8c2fbe145ad to your computer and use it in GitHub Desktop.
favicon
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http://stackoverflow.com/questions/5199902/isnt-it-silly-that-a-tiny-favicon-requires-yet-another-http-request-how-to-mak | |
| index.html | |
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <!-- Suppress browser request for favicon.ico --> | |
| <link rel="shortcut icon" href="#"> | |
| <script src="script.js"></script> | |
| ... | |
| script.js | |
| var favIcon = "\ | |
| iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABrUlEQVR42mNkwAOepOgxMTD9mwhk\ | |
| [...truncated for brevity...] | |
| IALgNIBUQBUDAFi2whGNUZ3eAAAAAElFTkSuQmCC"; | |
| var docHead = document.getElementsByTagName('head')[0]; | |
| 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. */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment