简体   繁体   English

iOS 和 Android 的不同 PWA 清单

[英]Different PWA manifests for iOS and Android

Is it possible to make Android devices (smartphones and tablets from all vendors) use a specific web manifest, and make iOS/iPadOS use another?是否可以让 Android 设备(所有供应商的智能手机和平板电脑)使用特定的 web 清单,并让 iOS/iPadOS 使用另一个清单?
They would differ because of iOS limited PWA support.由于 iOS 有限的 PWA 支持,它们会有所不同。
The index page is a simple static HTML document, no external framework is being used.索引页面是一个简单的 static HTML 文档,没有使用外部框架。

I would like to hear a javascript version as well, but this is how you achieve it using Nginx without if statements:我也想听听 javascript 版本,但这是使用 Nginx 而不使用 if 语句来实现它的方法:

NginX: NginX:

map $http_user_agent $manifest {
 ~*Android /manifest-and.json;
 ~*iPhone /manifest-ios.json;
 ~*iPad /manifest-ios.json;
 default /manifest-and.json;
}

location = /manifest.webmanifest {
 return 301 https://$host$manifest;
}

HTML: HTML:

<link rel="manifest" href="/manifest.webmanifest">

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

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