Jump to content

Favicon errors


Robin Somes

Recommended Posts

Encountered an issue with in CC6.25 / Google Chrome; favicons would not display. The following line in main.php:

 <link href="{$ROOT_PATH}favicon.ico" rel="shortcut icon" type="image/x-icon">

doesn't work with Chrome, which seems to prefer:

<link href="{$ROOT_PATH}favicon.ico" rel="ICON">

This, however, led to the issue of the $ROOT_PATH variable - I've seen reported on GitHub from 2018(?) that the var *included* a trailing slash, so that appending one would lead to a double // error.

As I'm now using

<link href="{$ROOT_PATH}/favicon.ico" rel="ICON"> - and it works in Chrome - can it be concluded that the trailing slash issue in $ROOT_PATH has now been rectified? In which case, can the <link href... line in main.php (and wherever else it occurs) be amended for future versions?

 

Link to comment
Share on other sites

I am thinking there is more to this.

My simple Google search for Chrome favicon shows a number of complaints, but they all seem to resolve into bypassing Chrome's favicon cache.

To do that, the HTML statement would be:

<link href="{$ROOT_PATH}favicon.ico?foo=bar" rel="shortcut icon" type="image/x-icon">

Note the querystring component: ?foo=bar

This prevents the browser from using a cached copy of the previous fetch.

I did not find any mention where Chrome requires a capitalized solitary ICON as the rel attribute's value.

In CubeCart's script ini.inc.php, $script_path is constructed to have a trailing slash (line 108) and this value is then used for {$ROOT_PATH}.

Link to comment
Share on other sites

Thank you bsmither; you're right, it does look more complex. I *have* found reference to using rel="icon" both historically and just now - but as with pretty much anything else, one never knows how legitimate it might be. I've run out of time to play around with it this afternoon; I'll return to it on Monday.

Robin

... just as an aside, I'm wondering about the significance of using {$ROOT_PATH}, rather than {$STORE_URL}, as was the case in previous versions of main.php; any reason why the latter won't still work?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...