25 lines
596 B
JavaScript
25 lines
596 B
JavaScript
document.head = document.head || document.getElementsByTagName('head')[0];
|
|
|
|
function changeFavicon(src) {
|
|
var link = document.createElement('link'),
|
|
oldLink = document.getElementById('dynamic-favicon');
|
|
link.id = 'dynamic-favicon';
|
|
link.rel = 'shortcut icon';
|
|
link.href = src;
|
|
if (oldLink) {
|
|
document.head.removeChild(oldLink);
|
|
}
|
|
document.head.appendChild(link);
|
|
}
|
|
|
|
function sleep(ms) {
|
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
}
|
|
|
|
while (true) {
|
|
changeFavicon('/favicon.ico');
|
|
await sleep(2000);
|
|
changeFavicon('/favicon2.ico');
|
|
await sleep(2000);
|
|
}
|