k-ivan / visual-bookmarks-chrome

Simple visual bookmarks extension for Google Chrome and Microsoft Edge.
https://chrome.google.com/webstore/detail/visual-bookmarks/jdbgjlehkajddoapdgpdjmlpdalfnenf
125 stars 24 forks source link

Some websites cannot get favicon #190

Open starsky0426 opened 1 week ago

starsky0426 commented 1 week ago

For example, https://zhihu.com/ cannot get its favicon.

The reason may be that it is linked to another url https://static.zhihu.com/heifetz/favicon.ico

k-ivan commented 1 week ago

Is it displayed for me, or do you mean something else? image

starsky0426 commented 1 week ago

Is it displayed for me, or do you mean something else? image

Thank you for your quick response!

I'm using Ubuntu 22.04 on chrome Version 130.0.6723.116 (Official Build) (64-bit),and the logo can be seen a few months ago occasionally both on Windows and Ubuntu, but i don't know why.

When i visited https://www.google.com/s2/favicons?sz=16&domain_url=zhihu.com, i got https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://zhihu.com&size=16 and the following image:

2024-11-06_17-10

k-ivan commented 1 week ago

It seems that the letter s is missing in the protocol name in your example. http => https https://zhihu.com Try it https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=https://zhihu.com&size=16

k-ivan commented 1 week ago

Edit the bookmark URL to include the https protocol. image

starsky0426 commented 1 week ago

It seems that the letter s is missing in the protocol name in your example. http => https https://zhihu.com Try it https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=https://zhihu.com&size=16

I got the same earth icon with https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=https://zhihu.com&size=16, and tried another network environment and got same result.

The url I set is https://zhihu.com/ from the beginning.

k-ivan commented 1 week ago

It seems that the letter s is missing in the protocol name in your example. http => https https://zhihu.com Try it https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=https://zhihu.com&size=16

I got the same earth icon with https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=https://zhihu.com&size=16, and tried another network environment and got same result.

The url I set is https://zhihu.com/ from the beginning.

Then it might be a regional issue with Google or something related to caching. Unfortunately, I can't influence this, but hopefully, it will resolve itself later.

starsky0426 commented 1 week ago

Can we add a feature to customize the favicon of the website, just like customize thumbnail image? For example, set https://www.zhihu.com/favicon.ico for https://zhihu.com

k-ivan commented 1 week ago

I never thought about it. I'll need to check if it's possible to display them via a link and whether permissions to the hosts are required for that. But even if it is possible, not all sites may have them with a default file name, so it still won't be perfect.

starsky0426 commented 1 week ago

191 I read some chrome extension docs https://developer.chrome.com/docs/extensions/how-to/ui/favicons, and found the code in your comment can solve this.

k-ivan commented 1 week ago

Thank you. I'm a bit busy with work right now, but I'll look into it when I have time. I used to work with the favicon API, but after the switch to Manifest v3, it started functioning differently and not as efficiently. Perhaps something has changed by now.

Another issue is that this API isn’t available in Firefox, though that’s not too critical.

k-ivan commented 1 week ago

Thank you. I'm a bit busy with work right now, but I'll look into it when I have time. I used to work with the favicon API, but after the switch to Manifest v3, it started functioning differently and not as efficiently. Perhaps something has changed by now.

Another issue is that this API isn’t available in Firefox, though that’s not too critical.

Another downside is that this API requires an additional permission, and it might not have icons for some websites, since it essentially uses the browser's icon cache.

starsky0426 commented 1 week ago

Thank you. I'm a bit busy with work right now, but I'll look into it when I have time. I used to work with the favicon API, but after the switch to Manifest v3, it started functioning differently and not as efficiently. Perhaps something has changed by now. Another issue is that this API isn’t available in Firefox, though that’s not too critical.

Another downside is that this API requires an additional permission, and it might not have icons for some websites, since it essentially uses the browser's icon cache.

I updated the code to use favicon api as fallback, credit to the ChatGPT. There might still have some perfomance issues because I'm not familiar with async. I used chrome storage to share faviconCache, it solved the perfomance issue.