The smallest GIF is still useful because it is the smallest possible valid favicon. This means you can stuff it into a data: URI to prevent useless requests showing up when you are working on something:
<link rel="icon" href="data:image/gif;base64,R0lGODlhAQABAAAAADs=">
If you're just wanting to shut the request up and aren't actually trying to display a certain favicon you can do:
With the bonus you've probably already remembered how to reconstruct this on demand just by reading this comment. It is "invalid" data but so is your example on Safari and Firefox instead of Chromium based browsers. It doesn't matter as much because that problem is local and silent in the logs, unlike the request.Thanks! I’m pretty sure I tried this ages ago and it didn’t work at the time, but I tried this again now and it does the job.
The key is to keep up through "data:" since any shorter (even just dropping the ":") and it gets treated a relative link instead.
You can also make an actually useful and readable SVG favicon this way:
Good to know! My goal is simply to stop a 404 popping up during development in the simplest way possible, so the smallest amount of code is best for me.