⬆️ ⬇️

Dynamic Favicon

A small essay on how to change Favicon without reloading the page.



Recently, we faced the task of how to dynamically change Favicon without reloading the page. The solution "in the forehead", i.e. replacing the href value of the favicon link did not give anything, I had to think hard and start trying all possible alternatives. A way to recreate the link node in the document worked. It managed to force to work everywhere, except Internet Explorer. There is a suspicion that he does not like the name of the file with the icon or its format (PNG).





<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

Change Favicon

/>





Change Favicon







Example link

')

UPD: Fixed some bugs in the code. Safari and IE still do not give up.

Source: https://habr.com/ru/post/18885/



All Articles