0

The dynamic html code listed below:

<link id="favicon" rel="shortcut icon" href="./favicon/favicon.ico" />
$("#favicon").attr("href","./favicon2/favicon2.ico");

Does not switch between two favicon image files on clicking of the browser tab.

View attached screenshot image for details.

Q: What is the correct code?

Background does not switch to the gray favicon image

Laurel
  • 5,771
  • 12
  • 29
  • 54
Harold H.
  • 7
  • 3

1 Answers1

0

Try deleting the old Favicon link and then adding a new one with the new image

I havent tested the code but there is already a post on Stackoverflow on this: Changing website favicon dynamically

Community
  • 1
  • 1
r3fresh_
  • 87
  • 1
  • 7
  • There are two favicon image files, e.g., gray background and white background: $("#favicon").attr("href","./favicon2/favicon2.ico"); – Harold H. Jul 09 '16 at 21:25