let link = document.querySelector("link[rel~='icon']");
if (!link) {
link = document.createElement('link');
link.rel = 'icon';
document.head.appendChild(link);
}
link.href = 'https://stackoverflow.com/favicon.ico';
With this, you can change a favicon to anything if the ico file is reachable.
I don't know how we could use this, but it's a case to consider. Maybe change the icon based on the player has achieved something? Change dynamically when we change the title? How would this impact the navigation history?
Is it possible to implement this without making the user experience heinous?
Consider the following script:
With this, you can change a favicon to anything if the
ico
file is reachable.I don't know how we could use this, but it's a case to consider. Maybe change the icon based on the player has achieved something? Change dynamically when we change the title? How would this impact the navigation history? Is it possible to implement this without making the user experience heinous?