【发布时间】:2019-09-14 08:22:36
【问题描述】:
在 PWA 闪屏方面,大家觉得https://pwa-splash.now.sh/ 和https://medium.com/@applification/progressive-web-app-splash-screens-80340b45d210 处的代码吗
是最新的和设备兼容的方式吗?还是人们发现了它的问题并进行了修改?
代码如下:
<link rel="apple-touch-startup-image" href="images/splash/launch-640x1136.png" media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)">
<link rel="apple-touch-startup-image" href="images/splash/launch-750x1294.png" media="(device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)">
<link rel="apple-touch-startup-image" href="images/splash/launch-1242x2148.png" media="(device-width: 414px) and (device-height: 736px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)">
<link rel="apple-touch-startup-image" href="images/splash/launch-1125x2436.png" media="(device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)">
<link rel="apple-touch-startup-image" href="images/splash/launch-1536x2048.png" media="(min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 2) and (orientation: portrait)">
<link rel="apple-touch-startup-image" href="images/splash/launch-1668x2224.png" media="(min-device-width: 834px) and (max-device-width: 834px) and (-webkit-min-device-pixel-ratio: 2) and (orientation: portrait)">
<link rel="apple-touch-startup-image" href="images/splash/launch-2048x2732.png" media="(min-device-width: 1024px) and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 2) and (orientation: portrait)">
更新 1:
针对下面 Robinyo 的回答,以上面的第一个例子为例:
<link rel="apple-touch-startup-image" href="images/splash/launch-640x1136.png" media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)">
横向需要添加以下行是吗?
<link rel="apple-touch-startup-image" href="images/splash/launch-**1136x640**.png" media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2) and (orientation: **landscape**)">
也许我错了,但我实际上不确定 iOS PWA 是否会处理它。原因是因为我在创建时读到(添加到主屏幕),iOS 选择了一个 png 并将其存储在本地。因此,下次打开 PWA 应用程序时,它会在尝试连接到 Web 之前使用该本地图像。所以我想知道的问题是 iOS 是否会在本地存储两张图片,一张用于纵向,一张用于横向。
【问题讨论】:
-
对于任何寻找的人,我都在使用这个生成器:appsco.pe/developer/splash-screens 用于我的初始屏幕,他们在代码中忘记了这个大小:(device-width: 414px) 和 (device-height: 736px)为您生成。
标签: ios splash-screen progressive-web-apps