当前位置: 动力学知识库 > 问答 > 编程问答 >

html - Universal favicon file for all sizes on all platforms?

问题描述:

I know that there are many devices that uses the favicon from the website in different ways...

On these favicon generator websites you can easy put an image there and the website will do the rest (generating several scaled images for certain devices)

If i want to cover ALL devices (Apple, Android, Windows Metro Tiles, and more) i would have to store 26 images (that are ALL the same picture just with different sizes)

And i would have to add 19 lines of HTML code to refer the certain devices to the certain images.

Is there a way to use just 1 file for all sizes?

I know that an ICO-File can contain multiple dimensions of an image.

I also know that a SVG-File doesn't depend on pixel resolution at all because it's vector based. (So a SVG can support EVERY imaginable size)

I could imagine to implement all sizes of an image to just a ICO or a SVG file where every device can pick it's optimal size.

Is that possible?

网友答案:

Its not exactly possible to serve different sized PNGs' in a single file.

SVG file would be the best hope here but.. Browsers today don't like them


Alternate option would be to use a tool that manages this process automatically.

I had the same frustration as you, so I simply came up with this tool called MakeFavicon

It helps create multiple favicons with predefined sizes and filenames at a desired folder, and also creates config files such as browserconfig.xml,manifest.json, partial view of HEAD to be included with relevant info.

I'm using it as a part of my Visual Studio build process and it works seamlessly to update all these files on every build.

Here's link to its example usage.

分享给朋友:
您可能感兴趣的文章:
随机阅读: