Display SVG favicon for PDF files - html

Before someone closes this because of mistakenly thinking it is a duplicated question, I'm referring to SVG favicon in particular instead of ICO format. And there is a reason for that.
I'm using an SVG favicon in order to support both light and dark modes. In other words, the icon will change colors automatically thanks to the #media (prefers-color-scheme: dark) query in the SVG file. I also have a favicon.ico placed in the root folder for fallback support (a.k.a. Safari mainly).
Yet, when I open a PDF in a new tab, favicon.svg will not be loaded instead, the favicon.ico is loaded regardless of whether the browser supports SVG favicon. That can be a problem because the two icons will look different in dark mode, where the SVG icon changes colors while the ICO doesn't.
So is there any way to make the browsers display the "correct" icon?

A picture paints a thousand icons
The browser will use favicon.ico or similar for the html content see the left 3 are coloured. However once an embedded frame has full focus it is the pdf viewers task to display any suited icon Here the blob and remote pdf and local pdf do not themselves have a favicon to fall back on.
Each browser pdf extension will be different but generally it is the browser that provides fall back. Lets use an example svg icon
Lets Icon nab it and apply it to another site
now lets try to display that in the iframe only
Clearly no problems in using SVG ico with PDF until you open in another tab
I think you are missing the rule that if there is nothing to display in the current html context then the common FALLBACK is addressRoot/favicon.ico so the browser will use that whatever the browser tab color light or dark. so design your ico to match the svg one. However once the addressRoot/ is clients device there is no favicon.ico other than built into the browser, it really has nothing to do with PDF viewer just that is where its more noticable.

Related

Favicon of format PNG doesn't appear on Google search result page

<link rel="shortcut icon" href="https://www.website.com/template/img/website/favicon.png?ver=v2.1.31">
We changed our 32x32 png favicon to a 48x48 png favicon, because one of our websites reverted back to the default Wordpress favicon and after deploying the change we noticed that the favicon was reverted back to the Wordpress favicon still on the websites we deployed. So I was wondering if there was a fool-proof way of making sure that our favicon appears on the search result page.
One of the answers I got from Googling was that we should change favicon.png to favicon.ico, but the Google documentation tells us it's not necessary. What changes can we do to make it work without changing the file format?
https://developers.google.com/search/docs/advanced/appearance/favicon-in-search
First, keep in mind that Google can take days or weeks before reflecting your icon in its search results. So any change you make needs patience, unfortunately.
However, you can get insights from Google. Visit https://www.google.com/s2/favicons?domain=www.website.com , just make sure to replace the domain parameter with your own site. There is no evidence that this is what Google is actually using to fill its results pages. But chances are that what this entry point returns is what you can expect in results pages a bit later.
According to me to add a favicon, one should use the .ico image. Otherwise, it might show some issues. Try converting your .png image to .ico by using this converter.
This will work for sure.
Here's a text from a webpage I searched about the favicon.
A favicon can actually be either a PNG, GIF, or ICO file. However, ICO files are typically used more than others as the file size is smaller and it is supported in all major browsers. PNGs are used more commonly for IOS, Android, and Windows 10 devices.
So according to this .ico is mostly preferred over any other extension of the image. Hence I would recommend you to use .ico extension for the image.

Favicon not showing on quick links on Android Google Chrome

The way I use to display the favicon on my website is to add a favicon.ico in the root folder.
It is working alright on the tabs of the desktop and also the tabs on Chrome in phone itself, but when it's in the quick links, I only see the first letter of my website name. so if the domain is example.com I see E instead of the favicon:
Will I have to add meta tag for favicon to make it show here, or it has nothing to do with it?
favicon.ico is used for low resolution icons, such as the one that appears in the tab. However, bookmark and add-to-home-screen images must be high resolution icons.
In order to have such icons for Android Chrome:
Preferably, provide a Web App Manifest, along with a 192x192 icon.
If you don't want to create such file, you can provide a 180x180 Apple Touch icon. It is simpler and more platforms support it (eg. iOS Safari).
As an alternative, you can use online favicon generators, such as RealFaviconGenerator, to create all these files for you. Full disclosure: I'm the author of this service.

Did I just create a real animated .JPG file?

It all started with this GIF image I found online: https://media.giphy.com/media/9fbYYzdf6BbQA/giphy.gif
I downloaded it to my computer, which runs Windows 10, put it on my desktop, and edited the file name to change ".gif" to ".jpg." The conversion ended up working fine, and I opened the image saved to my computer in my internet browser, Opera, just to see if it would still animate. It opened a file:// URL, and it showed the jpg normally, animating like a GIF would. So, I decided to see if other people saw the JPG animating like a gif, and on a forum site I am an admin for, I uploaded the image as an attachment to a thread. I made the thread, this was the image file I now had, basically just a normal JPG but animated: s4224.storage.proboards.com/5644224/t/crq4LpxP3rTT6eTORg1o.jpg
When I opened the image in Firefox, and got info on the image, Firefox still thought it was a gif in one area showing the file type, though. Internet Explorer said nothing about it being a GIF when I opened the image in that browser. I then saved the page as a JPG, uploaded it to vgy.me, and still got a .JPG result: vgy.me/dX1KGD.jpg
So, have I created a normal, animated .JPG image? Or is it still just a .GIF file that tricks internet browsers? I remember while I was inspecting the image in Opera that it showed the file/image type as "image/jpeg" as well. Seems to be keeping that metadata!
If you serve a file with a .jpg extension, web servers will normally serve that with a media type of image/jpeg, hence that what will get reported in the browser.
But in practice, image files have very different formats, and it's easy for browsers to inspect the file data itself to decide whether it's a JPG or GIF file and process it accordingly. The process that browsers use for doing this is defined in the MIME Sniffing Standard, which includes the MIME sniffing in an image context algorithm.
So, as Xufox says in their comment, it's still a GIF file regardless of its extension.
https://answers.microsoft.com/en-us/windows/forum/apps_windows_10-photos-winpc/living-images-in-windows-10-photo-app/15736942-9fa7-48eb-bfd4-2152acb582ce
"If you copy the file to a computer and then change the extension to .zip, and open the zip file, you will be able to see the separate jpeg and MP4 files inside. This is what you were asking I assume?"

How to set the favicon when viewing source in Chrome?

I have a page that displays the incorrect favicon when I view its source.
In the following image, you can see in the first tab (which is viewing the page) using the correct favicon - favicon-tenaya.ico.
However, when you go to view the page's source via Ctrl + U, it seems to display the default favicon - favico.ico, which is in the website's root folder:
Is there a way to get around this? We don't want the favicon changing when they view the source. How does the view source page in Chrome decide which favicon to use?
Viewing the source of a page is browser-dependent. There nothing you can do to force it to display a specific icon. For example, Firefox doesn't display any icon at all for a "View source" tab.
However, you can influence browsers to achieve this. For Chrome and your particular web site, replace the existing favicon.ico at the root of your web site with your favicon. This is what Chrome displays and yours is the black and white icon you don't want. Even better: rename favicon-tenaya.ico to favicon.ico (thus replacing the existing favicon.ico) and change the HTML accordingly.
As an aside, you don't need two declarations. Just keep the shortcut icon one, although the other one should do just as well.
Since Chrome does not parse the html it uses default file "/images/favicon.ico" to show as favicon in view-source. If it doesnt find it it look into different other locations too. for example if you use wordpress it uses http://[domain]/wp-content/themes/[theme]/images/favicon.ico
In Website, you can mention the favicon like below
<link rel="shortcut icon" href="/favicon-tenaya.ico"/>
and its working fine.
Where as in view source of chrome, they automattically find the favicon on below path
https://www.tenayalodge.com/favicon.ico
Favicon to be fetched from added favicon.ico after your website.
A very simple way:
put your favicon.ico file on the root of the website.
That should be accessed like: http://www.[domain].com/favicon.ico

Where to see font files loaded by chrome in the inspector?

What tab in chrome inspector shows the font files you're loading via font-face? I can't find it under resources. I'm having an issue where one group of font-family files are loading, but another font-family is not. I have checked everything from going directly to the URL and seeing they are indeed present, but I would like to look in the inspector and see it loading the one font-family but not the other. Is this possible with chrome?
You can also select any text node in the elements panel, then look at the bottom of the computed styles tab to see what fonts are rendered for that element
You can view the downloaded web fonts using the Network tab:
The best way so far
You can actaully do rightclick: inspect > Application (on the top tabs) > Frames (scroll on the left tabs) Then you can find a Font section where all loaded fonts are listed. It also has a preview for the fonts. It lists all fonts that are loaded in any possible way.
The best part is that, It also previews them on the right, to make it even easier to find the one
Then you can right-click on the one you chose and click open in a new tab, and it downloads it. Then you can add a .woff at the end of the filename and use it anywhere you like. (you can get its extension on the bottom of the preview too)