Favicon not applied in safari - ico

I'm applying the favicon using React Helmet Async on the Bun js dev server, and I'm trying to apply the favicon file to Safari as an ico file. But safari doesn't work. However, Chrome, Firefox, and Edge work just fine.
However, when I apply the favicon in index.html, it works properly in safari.
Safari not reading React Helmet Async's dynamic favicon changes?
Here is my React Helmet Async application code.
import IcoFavicon from 'assets/favicon.ico';
import SvgFavicon from 'assets/favicon.svg';
import { Helmet } from 'react-helmet-async';
<Helmet>
<link rel="icon" href={IcoFavicon} />
<link rel="icon" href={SvgFavicon} />
...
</Helmet>
I also used favicon.ico in index.html but it didn't work in both chrome and safari.
So I applied it in React Helmet Async.
Here is my old Index.html code.
...
<link rel="icon" href="/favicon.ico" /> // I've tried both %PUBLIC_URL%/favicon.ico and ./favicon.ico as well as this path.
...

Related

Favicon not showing in safari(iOS 12 13) but showing normally in Chrome(Android and PC)

My team are now developing a vue-cli based webapp that aims to works on Safari(iOS) and Chrome(android).
The favicon show normally on chrome but not showing in safari, or showing on some pages but not in some page.
I've figuring on this issue for like two weeks.
I tried to force refresh the favicon by ./favicon?v=2, or use full url path or relative path, or use several different way to write favicon, but nothing works.
Sometimes the favicon just show for a second and a disappear.
Some pages say the safari iphone can be heavily cached but i can't find a good way to clean the cache.
I use vue-cli so the below link tag is written in public/index.html like below, and the favicon in public/favicon.ico.
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
after build, above code become code like
<link rel="icon" href="https://www.mysitesite.com/favicon.ico">
chrome android or chrome pc show normally but not safari ios
I also tried some code like below but don't work.
<link rel="icon" href="https://www.mysitesite.com/favicon.ico?v=2" />
<link rel="icon" href="https://www.mysitesite.com/favicon.png?v=2" />
<link rel="icon" href="./favicon.ico?v=2" />
<link rel="icon" href="./favicon.ico?v=2" />
also, I tried generate favicon path by html-webpack-plugin but not show in safari.
apple-touch-icon shows when i bookmarked but favicon didn't show on the safari tab.
<link rel="apple-touch-icon" sizes="180x180" href="./apple-touch-icon-180x180.png">
Does anybody knows the solution or is this just a bug in safari?
Thank you so much.

Favicon is not showing if the URL starts with https://

I am facing one issue with favicon.ico. Here is my link rel code which has been included in header portion.
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
The problem is, I can view the favicon in all browsers if the url starts with http://. When the address starts with https://, the favicon is not showing in IE browser. Is there anything that I need to do? Did I miss anything important to include?
I had the same problem and fixed it by putting the following line in the head section of my html file:
<link rel="shortcut icon" href="">

Favicon link does download instead of show

I have a favicon on my page, and when i go to the link for the favicon: mypage/favicon.ico
It starts download, instead of just showing it as an online image (as every other site).
I've searched everywhere for a solution, but got no answer.
I want it to show, and not to be downloaded, what can be the problem?
<head>
<link rel="shortcut icon" href="/favicon.ico">
</head>
Its an .ico file at 32x32.
Thanks - Chris
You can show it in HTML as a regular image tag. This has been tested in Firefox 26, Chrome 29 and Internet Explorer 10. All with positive results. You can try on your own browsers if you'd like.
Code:
<!DOCTYPE html>
<html>
<body>
<img src = "logo.ico" type = "image/x-icon">
</body>
</html>
You should use
<head>
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
</head>
And consider to use another image e.g .png
<link rel="icon" href="/favicon.png" type="image/png" />
(Some Browsers does not support .ico)
If you call mypage/favicon.ico directly it might be dowloaded, depending on your http server/browser which mime type should be downloaded or displayed.
see Wikipedia.

iPhone ignoring CSS Stylesheet

I'm working on my very first (very lame) website, so apologies for the n00b question.
In Chrome/FF/Safari, my site renders the CSS fine. But on my iPhone or iPad (Chrome or Safari), my site renders as if there were no CSS styles at all. What's the cause?
Link to site
Thanks in advance!
you are referencing localhost for your stylesheet
<link rel="stylesheet" href="http://localhost:8888/kirbydev/assets/styles/styles.css" />
needs to be
<link rel="stylesheet" href="http://www.tvsonsale.co.uk/kirbydev/assets/styles/styles.css" />
or relative path so it works on local dev and production:
<link rel="stylesheet" href="/kirbydev/assets/styles/styles.css" />

Are all favicon sizes fetched from the server?

If I specify different image sizes for favicon PNGs like so:
<link rel="icon" type="image/png" sizes="16x16" href="/favicon.png" />
<link rel="icon" type="image/png" sizes="24x24" href="/favicon-24px.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32px.png" />
<link rel="icon" type="image/png" sizes="48x48" href="/favicon-48px.png" />
<link rel="icon" type="image/png" sizes="64x64" href="/favicon-64px.png" />
<link rel="icon" type="image/png" sizes="256x256" href="/favicon-256px.png" />
<link rel="icon" type="image/png" sizes="512x512" href="/favicon-512px.png" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
Does every one of these files get fetched?
Quoting from http://www.jonathantneal.com/blog/understand-the-favicon/:
How do these PNG-favicon-compatible browsers determine which favicon
should be used? Firefox and Safari will use the favicon that comes
last. Chrome for Mac will use whichever favicon is ICO formatted,
otherwise the 32×32 favicon. Chrome for Windows will use the favicon
that comes first if it is 16×16, otherwise the ICO. If none of the
aforementioned options are available, both Chromes will use whichever
favicon comes first, exactly the opposite of Firefox and Safari.
Indeed, Chrome for Mac will ignore the 16×16 favicon and use the 32×32
version if only to scale it back down to 16×16 on non-retina devices.
Opera, not wanting to take sides, will choose from any of the
available icons at complete random. I love that Opera does this.
And that’s just the beginning. Now it’s time to learn about the
Internet Explorer caveats.
While IE8-10 will display
the favicon on first load of the page, IE7 will skip the first load
and display the favicon during repeat visits. Worse yet, IE6 will only
display the favicon once the site has been bookmarked and reopened in
the browser. IE6 will also drop the favicon whenever the browser cache
is cleared, and it will not display the favicon again until the site
is either re-bookmarked, or the favicon is somehow reloaded. If IE6
and favicons mean a lot to you, you can force this reload with a
little JavaScript snippet, preferably wrapped in a conditional
comment.
<!-- I "support" IE6 -->
<!--[if IE 6]><script>(new Image).src="path/to/favicon.ico"</script><![endif]-->
According to the specification, the most appropriate icon will be used. So there is no a need to fetch something that has no use.
If multiple icons are provided, the user agent must select the most appropriate icon according to the type, media, and sizes attributes.
Surprisingly, I observed that some browsers are loading all PNG favicons, not only the most suitable one:
Chrome on Windows
Chrome on Android
Firefox on Windows
I didn't tested other settings, like Firefox on Android.
More about the "all favicons are loaded" issue.
The browser will get only one file, if any.