When you change the default favicon in Joomla! or you change a previously existing one, the browser (Google, Chrome, etc.) insists to show the old favicon (sometimes even if you have deleted the cache).
The problem is mainly caused by the browser that keeps in memory the favicon; even when the favicon file has been updated, because its file (favicon.ico) is always the same, the browser is unable to show the updated one.
In order to force the update of the favicon, it is sufficient to add inside the php code of the Joomla web page an element that always changes like the cuurrent timestamp. This trick avoids to necessarily delete the browser cache.
Warning! If you are not skilled in editing PHP files, you can damage your Joomla! installation, so, if you continue reading the instructions and you damage your web site you have been warned; anyhow before going ahead please make a backup of the file you are going to modify.
In details, in the case of Joomla 3.X, it is necessary to make the following simple change to Joomla! source code:
- Go to the root directory of your Joomla! installation
- Find the file called html.php in one of the following directories:
- Open html.php with a text editor (e.g. notepad++)
- Find the following string: "$this->addFavicon" without quotes (it is about row number 592 of the file)
- You will find the following row: $this->addFavicon(JUri::base(true) . $path . $icon);
- Let's change now the php code in the followig way: at the right of $icon, before the right parenthesis, add the following string (without double quotes and only the text in red):
- " . '?v='.round(microtime(true) * 1000)" (pay attention on the initial point)
- After the editing, the previous row will become:
- $this->addFavicon(JUri::base(true) . $path . $icon . '?v='.round(microtime(true) * 1000));
- Save the file.
- Refresh the browser.
- And FINALLY your new favicon will be visible both in bookmarks and in the tab of the browser
- If Joomla! will be updated and if Joomla! developers change the html.php file, the file we have modified will be overwritten and so you will need to make the change again. So, every time you update your Joomla! installation, check if the changes you have made in html.php are still there.
- If you try to access the favicon.ico file directly it, probably the old version will be shown. With this method it is possible to "cheat" the browser and force the update of the favicon only when a Joomla! web page is called.