Platform
#
isPlatformThe isPlatform
method can be used to test if your app is running on a certain platform:
Depending on the platform the user is on, isPlatform(platformName) will return true or false. Note that the same app can return true for more than one platform name. For example, an app running from an iPad would return true for the platform names: mobile, ios, ipad, and tablet. Additionally, if the app was running from Cordova then cordova would be true.
#
getPlatformsThe getPlatforms
method can be used to determine which platforms your app is currently running on.
Depending on what device you are on, getPlatforms
can return multiple values. Each possible value is a hierarchy of platforms. For example, on an iPhone, it would return mobile, ios, and iphone.
#
PlatformsBelow is a table listing all the possible platform values along with corresponding descriptions.
Platform Name | Description |
---|---|
android | a device running Android |
capacitor | a device running Capacitor |
cordova | a device running Cordova |
desktop | a desktop device |
electron | a desktop device running Electron |
hybrid | a device running Capacitor or Cordova |
ios | a device running iOS |
ipad | an iPad device |
iphone | an iPhone device |
mobile | a mobile device |
mobileweb | a web browser running in a mobile device |
phablet | a phablet device |
pwa | a PWA app |
tablet | a tablet device |