You can use Capacitor’s Device API:
import { Plugins } from '@capacitor/core';
const { Device } = Plugins;
const info = await Device.getInfo();
console.log(info);
It outputs platform:
{model: "Macintosh", platform: "web", appVersion: "", osVersion: "10.14.5", manufacturer: "Google Inc.", …}
2 Likes
sampath
February 19, 2020, 5:37pm
22
rip3rs
December 12, 2020, 12:28pm
23
if your using capacitor, I found this way to be really cool and simple
import { Capacitor } from '@capacitor/core'
...
console.log(Capacitor.isNative) // --> false
console.log(Capacitor.platform) // --> "web"
console.log(Capacitor.getPlatform()) // --> "web"
this is on a Mac OSX testing (due to having the inapp purchase)
more info:
capacitor
pendam
January 15, 2021, 2:27pm
24
if Browser insect mode with device frame ios then platform.is(‘ios’) is triggering.
and platform.is(‘cordova’) not working in ionic 3.
any suggestion please.