Favicon Storage and Retrieval | Best practice

I am trying to make my web application. a little bit faster. On each page there are from 20 to 200 images that are pulled from the Internet. They are actually signs, and the line of code below is suitable for me.

var google_favicon = 'http://www.google.com/s2/favicons?domain=' + domain; 

I could, of course, upload them and put them on my server. Because I donโ€™t know which way is the best practice, I just get them out of the Internet.

However, I would like to do it in the best way, which for me means the fastest. Is there an answer or does it depend on the quality of your hosting provider?

thanks

+4
source share
3 answers

It all depends on how fast / reliable the sites serving the content are, and how fast your server is. Many high-traffic sites use a content delivery network (CDN, such as Akamai) to serve their static content, since CDNs have servers located in many areas and can usually receive content faster for the user.

My assumption is that these icons are hosted by many different providers, which means that the โ€œuptimeโ€ of your site (as determined by the entire loading of content properly) will be the lowest common denominator of uptime for all sites that host your Images.

You also need to consider that since you do not control the sites that host these images, they can move / delete them at any time, and then they will be broken.

How often do you change images on your site? If this is not so common and you are concerned about operability / performance, I will probably try to serve them all from the host that you control, whether it be your own machine or something else.

+2
source

I donโ€™t know exactly how you use them, but if you want to optimize your site, you should at least consider putting them in one image file (the same as the sprite will be stored) and pull out an individual image via css.

Instead of having the client make 200+ requests, he would make only one for all the icons.

+2
source

It probably doesn't matter to the user whether the images are hosted on your server or elsewhere. When the browser sees <img src=...> , it makes an HTTP request to GET this image. Now, if you do not know that your hosting provider is much faster than the original web image source, I would say that this is not a hassle.

Especially considering that this is the Google we are talking about, they are likely to be much more accessible than your site can ever hope! (Geographic locality, bandwidth of the Internet provider, etc.) In addition, if the favicon icon changes, you do not need to worry about it, only Google does.

+1
source

Source: https://habr.com/ru/post/1389825/


All Articles