How to detect platform using Ionic 4

You can use Capacitor’s Device API:

import { Plugins } from '@capacitor/core';

const { Device } = Plugins;

const info = await Device.getInfo();

It outputs platform:

{model: "Macintosh", platform: "web", appVersion: "", osVersion: "10.14.5", manufacturer: "Google Inc.", …}

1 Like

This works for me:

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:

if Browser insect mode with device frame ios then‘ios’) is triggering.
and‘cordova’) not working in ionic 3.
any suggestion please.