The Dynamic Faviconner
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
version 1.0 / 1.1
- code not online anymore
- 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
- Favicon build up with PHP GD and Image Functions like
- Favicon then stored in
- Favicon placed in the meta tag using data URLs with Base64 encoding like:
- same as v1.3 but...
- Only the random RGB codes stored in
data URLis stored in a variable
- 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
- name of the file is [date|R|G|B].png
- On every pageload favicons older then 2 minutes wil be deleted
- same as v1.5 but...
- filenames now are [R|G|B.png]
- For the time beining old favicons are not deleted