Change PWA Look and Feel based on desktop browser platform?


#1

Ionic supports explicitly setting the platform using query params (e.g. ionicPlatform=ios). Ionic also displays the appropriate platform look and feel when my PWA is viewed in a browser on a mobile device.

But in a desktop browser my PWA I’d like it use the ios look and feel when viewed on a Mac, windows on windows, and android everywhere else.

I’ve been looking in the platform code and haven’t found how I can force the ionicPlatform switching to happen based on the browser’s OS. I read somewhere someone calling platform.setUserAgent() with a windows browser useragent to force what I’m looking for on windows platforms. So I could do that for all three platforms…

Is there was a better solution?


#2

See:

Once you know the OS you can then toggle your theme:

See: