简体   繁体   English

iOS apple-touch-icon仅适用于一个URL

[英]iOS apple-touch-icon works only on one URL

I have a single-page Progressive Web App (accessed from iPhones), and I've added the following to my <head> : 我有一个单页的渐进式Web应用程序(可从iPhone访问),并且已在<head>添加了以下内容:

<link rel="apple-touch-icon" href="img/appicon/acme_homescreen_60x60.png">
<link rel="apple-touch-icon" sizes="120x120" href="img/appicon/acme_homescreen_120x120.png">
<link rel="apple-touch-icon" sizes="152x152" href="img/appicon/acme_homescreen_152x152.png">
<link rel="apple-touch-icon" sizes="167x167" href="img/appicon/acme_homescreen_167x167.png">
<link rel="apple-touch-icon" sizes="180x180" href="img/appicon/acme_homescreen_180x180.png">

This works on https://acme.com/login , so there's no basic problem such as misspelled file name, wrong path, password protection, ... Yet it doesn't work on https://acme.com/selection nor any other URL besides /login. 这可以在https://acme.com/login上使用 ,因此没有基本问题,例如文件名拼写错误,路径错误,密码保护... ...但是在https://acme.com/selection上也不起作用/ login以外的任何其他URL。 I get the default screenshot there. 我在那里得到默认屏幕截图。

I double checked: There's the same <head> on all URLs, so what am I missing? 我仔细检查了一下:所有URL上都有相同的<head> ,那么我缺少什么呢?

PS: I cannot use https://realfavicongenerator.net/favicon_checker as suggested here , as the server is running locally. PS:由于服务器在本地运行,因此无法按照此处的建议使用https://realfavicongenerator.net/favicon_checker

While I still not understand why it's working on /login, the solution seems to be to put an (additional) apple-touch-icon.png in the root directory . 虽然我仍然不明白为什么它可以在/ login上运行,但是解决方案似乎是在根目录中放置一个(附加的) apple-touch-icon.png In order to have all icons in one place I moved all the referenced icons to the root, but it seems to be sufficient to have apple-touch-icon.png there. 为了将所有图标放在一个位置,我将所有引用的图标移到了根目录,但是在那里放置apple-touch-icon.png似乎就足够了。

To use the root directory is mentioned in the documentation , to be fair. 公平地说,在文档中提到使用根目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM