Html Windows 8 上 `msapplication-TileImage` 的 Favicon 备份。
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24625305/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Favicon backup for `msapplication-TileImage` on Windows 8.
提问by Roboneter
I have a simple yes/no question.
我有一个简单的是/否问题。
If I don't put this in my HTML file:
如果我不把它放在我的 HTML 文件中:
<meta name="msapplication-TileImage" content="favicon.png">
Will Windows 8 automatically use this PNG:
Windows 8 会自动使用这个 PNG:
<link rel="icon" href="favicon.png">
I don't have a Windows 8 machine to test it.
我没有 Windows 8 机器来测试它。
回答by L84
The simple answer is yes, it will use the favicon.
简单的答案是肯定的,它将使用收藏夹图标。
With that said, it may not display in the most optimal fashion.
话虽如此,它可能不会以最佳方式显示。
Here is a screenshot with a test I ran:
这是我运行的测试的屏幕截图:
Update
更新
My answer that I originally posted is still valid but there is a better way:
我最初发布的答案仍然有效,但有更好的方法:
Custom Tiles for IE 11+ on Windows 8.1+
Windows 8.1+ 上 IE 11+ 的自定义磁贴
IE 11+ on Windows 8.1+ does offer a way to create pinned tiles for your site.
Windows 8.1+ 上的 IE 11+ 确实提供了一种为您的网站创建固定磁贴的方法。
Microsoft recommends creating a few tiles at the following size:
Microsoft 建议按以下大小创建一些磁贴:
Small: 128 x 128
Medium: 270 x 270
Wide: 558 x 270
Large: 558 x 558
小号:128 x 128
中:270 x 270
宽:558 x 270
大:558 x 558
These should be transparent images as we will define a color background next.
这些应该是透明图像,因为我们接下来将定义颜色背景。
Once these images are created you should create an xml file called browserconfig.xml
with the following code:
创建这些图像后,您应该创建一个browserconfig.xml
使用以下代码调用的 xml 文件:
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square70x70logo src="images/smalltile.png"/>
<square150x150logo src="images/mediumtile.png"/>
<wide310x150logo src="images/widetile.png"/>
<square310x310logo src="images/largetile.png"/>
<TileColor>#009900</TileColor>
</tile>
</msapplication>
</browserconfig>
Save this xml file in the root of your site. When a site is pinned IE will look for this file. For additional information on IE 11+ custom tiles and using the XML file visit Microsoft's website.
将此 xml 文件保存在您站点的根目录中。当站点被固定时,IE 将查找此文件。有关 IE 11+ 自定义磁贴和使用 XML 文件的更多信息,请访问 Microsoft 网站。
Old Answer
旧答案
The best way to incorporate a favicon for Windows 8 is to use the following code:
为 Windows 8 合并收藏夹图标的最佳方法是使用以下代码:
<meta name="msapplication-TileColor" content="#D83434">
<meta name="msapplication-TileImage" content="path/to/tileicon.png">
The first line is the tile color, you can use a hex value, RGB or a CSS color name. The second line is the path to the icon. For best results the icon should be transparent and sized at 144x144 pixels.
第一行是瓷砖颜色,您可以使用十六进制值、RGB 或 CSS 颜色名称。第二行是图标的路径。为获得最佳效果,图标应为透明且大小为 144x144 像素。