Jump to content
Sign in to follow this  
Robin Somes

Favicon errors

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?


Share this post

Link to post
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}.

Share this post

Link to post
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.


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

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...