В head:
<link rel="icon" href="/favicons/favicon.ico" type="image/x-icon">
function setFavicon(url) {
var link = document.querySelector('link[rel=icon]')
link.setAttribute('href', url)
}
function startAnimation(icons, initial) {
initial = initial === undefined ? 0 : initial
setFavicon(icons[initial])
var next = icons.length <= initial + 1 ? 0 : initial + 1
setTimeout(function () {
startAnimation(icons, next)
}, 1000)
}
var icons = [
'https://habr.com/images/favicon-32x32.png',
'https://nextjs.org/static/favicon/favicon.ico'
]
startAnimation(icons)