Question

According to devdocs of magento 2.3.0 I tried to add a favicon manually.

https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/themes/favicon.html

Attempt 1:

/magento2/app/design/frontend/Magento GJ/theme-GJ/Magento_Theme/layout => here goes the default_head_blocks.xml file

<?xml version="1.0"?>

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <link src="Magento_Theme::favicon_32x32.png" rel="icon" type="image/x-icon" sizes="32x32"/>
    </head>
</page>

/magento2/app/design/frontend/Magento GJ/theme-GJ/Magento_Theme/web => here goes the favicon_32x32.png file

=> This works only in Firefox!

Attempt 2:

Then I tried just for fun to add in the root directory my own favicon.ico.

/magento2/app/design/frontend/Magento GJ/theme-GJ/Magento_Theme/

=> This works for Safari, Chrome and Edge. The IE does not work.

Attempt 3:

According to the magento 2.3.0 bug to add a favicon over the backend I solved this issue also:

Magento 2.3 favicon and logo upload does not take hold

Then I tried to upload my favicon. => All browsers can handle the favicon.

I want to know why the first attempt does not work for all browsers? - I am at a loss :/

Was it helpful?

Solution 2

Solution: The .ico file need to be under <vendor>/<theme>/web/ directory. Without the .ico file the .png images are not working on every browser.

OTHER TIPS

Magento favicon icon with type="image/x-icon" should be of file type .ico, in your case you used a .png instead and that makes it behave abnormally.
To validate it, try using a favicon.ico file

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top