Dynamic Flash generated favicon

// February 27th, 2009 // Experiments, Source code & tutorials

Via Bnox I saw that you can change your favicon dynamically. After some research I found out that the magic trick lays in 3 lines of javascript:

(fi = the path to the favicon )

function setFavIcon(fi)
{
	var	icon=document.getElementById('favicon');
	(newIcon = icon.cloneNode(true)).setAttribute('href',fi);
	icon.parentNode.replaceChild(newIcon,icon);
}

Sadly, it only seems to work in FireFox and Opera. If you have a solution for this problem, please leave a comment.

Since Flash easily can generate png’s and talk to Javascript, that called for a little experiment:
You can draw your own favicon for this site on the canvas below. It updates automatically.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

4 Responses to “Dynamic Flash generated favicon”

  1. eric says:

    Ya lo he visto ^^

  2. Kris says:

    Sorry Eric, my Spanish isn’t that good. what do you mean?

  3. luuk says:

    hehe echt te bizar
    ik kan er echt totaal geen functie voor verzinnen, maar toch leuk :P

  4. Lokka says:

    Hoe maak je zo iets? briljante mensen ! :P

Leave a Reply