• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Replace 'favicon.jpg' with other image

Q&A Forum › Category: ESP32 › Replace 'favicon.jpg' with other image
0 Vote Up Vote Down
Stephen asked 2 years ago

Hello Sara & Rui,
re. Build Web Server ESP32 v2.2 Course – Page 184.
In previous sections of the course I have been able to replace the ‘favicon.png’ with my own ‘stilsonsFull.png’ and call it successfully from the .html file.
I cannot call it from the ‘1-2 Hello World  WS SPIFFS’ web page.
Attempt 1, I have included MY icon image file in the ‘data’ directory and changed the ‘href=’ to href=”stilsonsFull.jpg” in the .html file, uploaded both –  with no success.
Attempt 2,  I have renamed my icon to ‘favicon.png’ , changed the href= back to href=”favicon.png” uploaded both – still with no success.
After Uploading Filesystem Image and Hello World files the Icon is still the original  ‘favicon.png’ image.
How can I use my own icon in the Web Page Title?
Regards,
Stephen

Question Tags: Web Page Title Icon
5 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

Hi.

Did you hard refresh the web browser?

When you added your own picture for favicon, what did you change in the code? Can you share the lines of code?

Regards,
Sara

0 Vote Up Vote Down
Stephen answered 2 years ago

Good morning Sara.
Yes I did refresh the browser, I’m using Firefox.
main.cpp follows:-

#include <Arduino.h>
#include <WiFi.h>
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include “SPIFFS.h”

// Replace with your network credentials
const char* ssid = “my ssid”;
const char* password = “my pw”;

// Create AsyncWebServer object on port 80
AsyncWebServer server(80);

// Initialise SPIFFS W/- this Function to be called in ‘setup()’
void initSPIFFS() {
if (!SPIFFS.begin(true)) {
Serial.println(“An error has occurred while mounting SPIFFS”);
}
else{
Serial.println(“SPIFFS mounted successfully”);
}
}

// Initialise WiFi w/- this Function to be called in ‘setup()’
void initWiFi() {
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
Serial.print(“Connecting to WiFi ..”);
while (WiFi.status() != WL_CONNECTED) {
Serial.print(‘.’);
delay(1000);
}
Serial.println(WiFi.localIP());
}

void setup() {
Serial.begin(115200);
initWiFi();
initSPIFFS();

server.on(“/”, HTTP_GET, [](AsyncWebServerRequest *request)
{
request->send(SPIFFS, “/index.html”, “text/html”);
});
server.serveStatic(“/”, SPIFFS, “/”);
server.begin();
}

void loop() {
}

 
index.html – code follows:-
 

<!DOCTYPE html>
<html>
<head>
<title>Stevie’s ESP Web Server</title>
<meta name=”viewport” content=”width=device-width, initial-scale=1″>
<link rel=”stylesheet” type=”text/css” href=”style.css”>
<link rel=”icon” type=”image/png” href=”favicon.png”>
</head>
<body>
<h3>G’Day Stevie!</h3>
<h3>HowYa Goin’?</h3>
<p>Well Done Mate !!<br>Looks Like it’s working – Beaudy..</p>
</body>
</html>

 
The ‘data’ folder includes:-
-index.html,
-#styles.css,
and the ‘favicon.png’ file  (the favicon.png file is actually my own image renamed however the browser still displays your original image, it is not picking up my own image ???
 
Regards,
Stephen.

0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

If you go to the web server IP address followed by /favicon.png, what do you see?
Did you upload the filesystem image again?
Did you refresh the web browser with CTRL+F5.?
Regards.
Sara

0 Vote Up Vote Down
Stephen answered 2 years ago

Hello Sara (well done to win World Cup down here, Spain played beautifully)
It appears I have found the problem and have fixed it –
Firefox was storing the favicon in cache and restarting FF did not clear the cache.
Another web site suggested clearing the cache and this worked, using Control+F5 is much faster of course.
This link also shows how to ‘Force FireFox to reload page ignoring cache’
https://resrequest.helpspot.com/index.php?pg=kb.page&id=385
Thanks again for your help,
Stephen.

0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

Great.
I’m glad the issue is solved.
I’ll mark this issue as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.