Problem

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).

Cause

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.

Solution

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:

  1. Go to the root directory of your Joomla! installation
  2. Find the file called html.php in one of the following directories:
    • /libraries/joomla/document/html.php 
    • /libraries/joomla/document/html/html.php
  3. Open html.php with a text editor (e.g. notepad++)
  4. Find the following string: "$this->addFavicon" without quotes (it is about row number 592 of the file)
  5. You will find the following row: $this->addFavicon(JUri::base(true) . $path . $icon);
  6. 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): 
  7. . '?v='.round(microtime(true) * 1000)"  (pay attention on the initial point)
  8. After the editing, the previous row will become:
  9.  $this->addFavicon(JUri::base(true) . $path . $icon . '?v='.round(microtime(true) * 1000)); 
  10. Save the file.
  11. Refresh the browser.
  12. And FINALLY your new favicon will be visible both in bookmarks and in the tab of the browser

 

Notes

  • 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.

 


Italian Arabic Chinese (Simplified) English French German Hebrew Russian Spanish
491012
OggiOggi49
IeriIeri195
SettimanaSettimana481
MeseMese1468
Galleria video