Created
September 23, 2015 21:48
-
-
Save yblee85/b53b19b7fa57fe2f42df to your computer and use it in GitHub Desktop.
update favicon dynamically
This file contains 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
function updateFavicon(faviconURL) { | |
var src = faviconURL; | |
var head_node = document.head || document.getElementsByTagName('head')[0]; | |
var link = document.createElement('link'), | |
oldLink = document.getElementById('favicon'); | |
link.id = 'favicon'; | |
link.rel = 'shortcut icon'; | |
link.href = src; | |
if (oldLink) { | |
head_node.removeChild(oldLink); | |
} | |
head_node.appendChild(link); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment