Polizi8
Polizi8

Reputation: 277

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.

Upvotes: 1

Views: 429

Answers (1)

Polizi8
Polizi8

Reputation: 277

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">

Upvotes: 1

Related Questions