简体   繁体   中英

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?
They would differ because of iOS limited PWA support.
The index page is a simple static HTML document, no external framework is being used.

I would like to hear a javascript version as well, but this is how you achieve it using Nginx without if statements:

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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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