是否可以将所有图标链接到外部文件?

时间:2014-04-15 23:40:18

标签: html responsive-design icons

我有不同的ipad,iphone和其他设备图标。

是否可以使用外部文件引用所有这些内容?或者我是否需要在每个页面的头部分粘贴所有这些链接?

<link rel="apple-touch-icon" href="img/apple-touch-icon-iphone.png">
<link rel="apple-touch-icon" sizes="72x72" href="img/apple-touch-icon-ipad.png">
<link rel="apple-touch-icon" sizes="114x114" href="img/apple-touch-icon-iphone-retina-display.png">
<link rel="shortcut icon" href="img/favicon.ico">

1 个答案:

答案 0 :(得分:0)

您不必在每个页面中声明Apple touch图标。没有“外部文件”技术,但是Apple defines both declarations and file naming conventions.您可以使用这些约定来避免额外的HTML代码。

要做到这一点:

  • 删除声明Apple触摸图标的三个link标记。
  • 将您的图标放在网站的根目录(即/)中。
  • 根据Apple规范重命名您的图标:apple-touch-icon-72x72.pngapple-touch-icon-114x114.png等。

iOS设备仍然可以找到它们。这种做法的警告提示:对于iOS设备,这是可以的。但是其他一些平台,比如Android,也使用这些图标。这些平台可能无法使用Apple定义的约定(声明支持更为广泛)。

关于图标尺寸的另一个注意事项:72x72和114x114适用于iOS 6及之前版本。确保定义Apple touch icons with the right sizes