links of this project need to open on it's own because of dynamicly insert a part of the <head> element

The Dynamic Faviconner

an idea of Richard Derks

This project was a collaboration with Peter van der Gulden.

The lack of a dynamic favicon (the small website icon commonly showed in browsers) following the generated random color on randomcolour.com bothered us.

A "problem" screaming to be tackled.

The biggest challenge at the time was that browsers not alway saw the favicon as a (fully valued) part of the DOM. So it wasn't just a matter of cache.

But (as quite often) the solution was blood simple. Image created on-the-fly and each time give the favicon an unique name

Versions

version 1.0 / 1.1
  • code not online anymore
version 1.2
  • Because of shifting files for different versions this is not the real v1.2 anymore :(
  • Just leave it here thou. Just know in the end only the last version is what matters
  • At the time it worked in Chrome but Firefox kept using "a" favicon from a cache somewhere (not in the usual cache dir). That was annoying because we did use a unique favicon name for every page load.
  • later on (around ) it also worked in newer versions of FF
version 1.3
  • Favicon build up with PHP GD and Image Functions like imagecreatetruecolor(), imagecolorallocate() and imagefill()
  • Favicon then stored in $_SESSION[]
  • Favicon placed in the meta tag using data URLs with Base64 encoding like: data:image/png;base64
version 1.4
  • same as v1.3 but...
  • Only the random RGB codes stored in $_SESSION[]
  • the data URL is stored in a variable
version 1.5
(first version build in the original randomcolour.com code)
  • Our code added (by Peter) to the original HTML of randomcolour.com
  • A real PNG file is made and stored on the server and than it's called in the link/shortcut tag
  • name of the file is [date|R|G|B].png
  • On every pageload favicons older then 2 minutes wil be deleted
version 1.6
(as long as there is no better version)
  • same as v1.5 but...
  • filenames now are [R|G|B.png]
  • For the time beining old favicons are not deleted