gpt4 book ai didi

html - html head 或 htaccess 文件中的苹果触摸图标

转载 作者:可可西里 更新时间:2023-11-01 06:22:24 24 4
gpt4 key购买 nike

我正在构建一个新的网络应用程序。

我的网站图标和苹果图标都已准备就绪。我想知道我是否需要将它们包含在我的 HTML 文件的“头部”中 - 或者是否可以从 .htaccess 文件中路由它们?

HTML代码:

<head>
<link rel="shortcut icon" href="assets/ico/favicon.ico">
<!-- Standard iPhone -->
<link rel="apple-touch-icon" sizes="57x57" href="touch-icon-iphone-114.png" />
<!-- Retina iPhone -->
<link rel="apple-touch-icon" sizes="114x114" href="touch-icon-iphone-114.png" />
<!-- Standard iPad -->
<link rel="apple-touch-icon" sizes="72x72" href="touch-icon-ipad-144.png" />
<!-- Retina iPad -->
<link rel="apple-touch-icon" sizes="144x144" href="touch-icon-ipad-144.png" />
</head>

或者只是将它们放在 htaccess 中?

    # Rewrite for Favicons
RewriteRule ^favicon\.ico$ assets/ico/favicon.ico [L]
RewriteRule ^apple-touch-icon\.png$ assets/ico/apple-touch-icon.png [L]
RewriteRule ^apple-touch-icon-57x57\.png$ assets/ico/apple-touch-114-icon.png [L]
RewriteRule ^apple-touch-icon-114x114\.png$ assets/ico/apple-touch-icon-114.png [L]
RewriteRule ^apple-touch-icon-72x72\.png$ assets/ico/apple-touch-icon-144.png [L]
RewriteRule ^apple-touch-icon-144x144\.png$ assets/ico/apple-touch-icon-144.png [L]

问题将它们放入我的 .htaccess 文件并从我的 HTML 中删除它们是否有任何负面影响?

最佳答案

如果您遵循 Apple 的命名约定,则不必指定它们。

来自 Apple 的 documentation :

If no icons are specified using a link element, the website root directory is searched for icons with the apple-touch-icon... or apple-touch-icon-precomposed... prefix. For example, if the appropriate icon size for the device is 57 x 57, the system searches for filenames in the following order:

  • apple-touch-icon-57x57-precomposed.png
  • apple-touch-icon-57x57.png
  • apple-touch-icon-precomposed.png
  • apple-touch-icon.png

关于html - html head 或 htaccess 文件中的苹果触摸图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10756350/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com