Favicon
Posted: Sat Mar 26, 2022 6:44 pm
Hello,
I have tried for some time to get this to work without success. I simple want to serve a Favicon via the webserver.
I have multiple webpages all being served fine without an issue. This is the code I have but on loading a webpage I do not get the Favicon and if I go to the root and add /favicon.ico or .png I get a grey square but not the 16 x 16 icon image.
Any advice gladly accepted.
Thank you
Ian
I have tried for some time to get this to work without success. I simple want to serve a Favicon via the webserver.
I have multiple webpages all being served fine without an issue. This is the code I have but on loading a webpage I do not get the Favicon and if I go to the root and add /favicon.ico or .png I get a grey square but not the 16 x 16 icon image.
Code: Select all
server.on("/favicon.ico", Fav);
server.on("/favicon.png", Fav);
Code: Select all
void Fav() {
char Favicon[487] = {
0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x06, 0x00, 0x00, 0x00, 0x1F, 0xF3, 0xFF,
0x61, 0x00, 0x00, 0x00, 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xAE, 0xCE, 0x1C, 0xE9, 0x00, 0x00,
0x01, 0xA1, 0x49, 0x44, 0x41, 0x54, 0x38, 0x4F, 0xAD, 0x93, 0x3F, 0x2C, 0x43, 0x61, 0x14, 0xC5,
0x7F, 0x5F, 0xFF, 0xBE, 0xD7, 0xA2, 0x94, 0x36, 0x4D, 0x2C, 0x4D, 0x13, 0x0B, 0x62, 0x69, 0x52,
0x89, 0xC5, 0x24, 0xDA, 0x4D, 0x84, 0xC9, 0x68, 0x6A, 0xBB, 0x59, 0x89, 0x10, 0x91, 0x20, 0x11,
0x53, 0x0D, 0xB4, 0x4B, 0x07, 0x1B, 0x1B, 0x9B, 0x88, 0x81, 0x68, 0x6A, 0x23, 0x31, 0x34, 0x16,
0xFF, 0x87, 0x26, 0x5E, 0xD2, 0xE2, 0xB5, 0xF4, 0x3D, 0x79, 0x4F, 0x54, 0x2C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