SoftAP HTTP, can it send a favicon

Just tried the SoftAP HTTP Page example and works great. Thanks for having that example in the Firmware Reference.

So I wanted to also add a favicon to it. I converted my favicon to an array. like so.
const char MI[] = {0xFF, 0xBD, 0xB6,0x31, 0x86, 0x29, 0x45, 0x29, 0x45, 0x29…(of course much more here) };

Then added the following to Page myPages[]:
{ “/favicon.ico”, “image/bmp”, MI },

When I open the page, I can see the request for /favicon.ico, but it’s never displayed in the browser.

Any ideas what I can do ?

Hi @seulater

I would open up the browser debug console and see if there are any errors.

I think you need to Base64 encode your image data and your HTML should look like this:

<link href="data:image/x-icon;base64,YourBase64StringHere" rel="icon" type="image/x-icon" />

2 Likes

Thank you for the help, I will check the console and see whats it says.
but concerning the HTML, I am a bit confused with that, because when you open the browser it automatically requests the favicon.ico file.

Most browsers will request the favicon from the base directory of the site but different browsers have different requirements for sizes and coding. The inline method always works with one set of bytes.

Also browser caching can fool you–you have to clear the cache to see any changes, particularly in chrome.

2 Likes