[英]Does the apple touch icon have to be in the root folder?
A seemingly simple question that I can't find a clear answer to. 一个看似简单的问题,我无法找到明确的答案。
Does the apple touch icon have to be in the root folder of my site? apple touch图标是否必须位于我网站的根文件夹中?
<link href="http://example/apple-touch-icon.png" rel="apple-touch-icon" />
Or is it okay if I place it in another location? 或者,如果我把它放在另一个地方可以吗?
<link href="http://www.yoursite.com/some/other/folder/apple-touch-icon.png" rel="apple-touch-icon" />
Not necessarily. 不必要。 From the Safari Web Content Guide , the Configuring Web Applications section states:
在Safari Web内容指南中 ,“ 配置Web应用程序”部分指出:
- To specify an icon for the entire website (every page on the website), place an icon file in PNG format in the root document folder called
apple-touch-icon.png
要指定整个网站的图标(网站上的每个页面),请将PNG格式的图标文件放在名为
apple-touch-icon.png
的根文档文件夹中To specify an icon for a single webpage or replace the website icon with a webpage-specific icon, add a link element to the webpage, as in:
要为单个网页指定图标或使用特定于网页的图标替换网站图标,请在网页中添加链接元素,如下所示:
<link rel="apple-touch-icon" href="/custom_icon.png">
To specify multiple icons for different device resolutions—for example, support both iPhone and iPad devices—add a
sizes
attribute to each link element as follows:要为不同的设备分辨率指定多个图标(例如,同时支持iPhone和iPad设备),请为每个链接元素添加一个
sizes
属性,如下所示:
<link rel="apple-touch-icon" href="touch-icon-iphone.png">
<link rel="apple-touch-icon" sizes="76x76" href="touch-icon-ipad.png">
<link rel="apple-touch-icon" sizes="120x120" href="touch-icon-iphone-retina.png">
<link rel="apple-touch-icon" sizes="152x152" href="touch-icon-ipad-retina.png">
The icon that is the most appropriate size for the device is used.
使用最适合设备大小的图标。 If no sizes attribute is set, the element's size defaults to 60 x 60.
如果未设置sizes属性,则元素的大小默认为60 x 60。
You should be able to place it in another folder and use the link
elements to refer the browser to the alternate location of the apple-touch-icon
file, and have it work just fine. 您应该能够将它放在另一个文件夹中,并使用
link
元素将浏览器引用到apple-touch-icon
文件的备用位置,并使其正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.