I want to have a Website, that displays the normal Favicon in most of the time but sometimes (In a rare case) I want it to show a different Favicon. Let's say we have a 10% Chance. Then it should display the second Favicon once in 10 Page refreshes. Right now I just have the Favicon1.ico and Favicon2.ico. Right now I'm only able to use 1. <link rel="icon" type="image/png" href="..\images\favicon.ico" sizes="32x32" />
. I assume that with JavaScript I could do something like that but I couldn't find an answer.
Asked
Active
Viewed 50 times
-1

Sandro Cutri
- 68
- 10
-
1This is about changing the 's href, which in general means setting an element's attribute. This is very easy to do in JS. Google "js set attribute". – Feb 16 '22 at 12:30
1 Answers
0
Hi in the following link the subject of being able to change the favicon in a dynamic way is covered, it can serve as a guide, you will only need to create a function so that you assign the behavior you want, Greetings
-
It is a great help even tho it didn't cover the x-chance of being the other one part. Thankfully I found out how to do it. – Sandro Cutri Feb 16 '22 at 14:20