ons.platform

Utility methods to detect current platform.

Methods Summary

Signature Description
select(platform) Sets the platform used to render the elements. Useful for testing.
isWebView() Returns whether app is running in Cordova.
isIOS() Returns whether the OS is iOS.
isAndroid() Returns whether the OS is Android.
isAndroidPhone() Returns whether the device is Android phone.
isAndroidTablet() Returns whether the device is Android tablet.
isIPad() Returns whether the device is iPad.
isBlackBerry() Returns whether the device is BlackBerry.
isOpera() Returns whether the browser is Opera.
isFirefox() Returns whether the browser is Firefox.
isSafari() Returns whether the browser is Safari.
isChrome() Returns whether the browser is Chrome.
isIE() Returns whether the browser is Internet Explorer.
isEdge() Returns whether the browser is Edge.
isIOS7above() Returns whether the iOS version is 7 or above.

Methods

select(platform)

Sets the platform used to render the elements. Useful for testing.

Parameters
Name Type Description
platform string Possible values are: “opera”, “firefox”, “safari”, “chrome”, “ie”, “android”, “blackberry”, “ios” or “wp”.

isWebView(): Boolean

Returns whether app is running in Cordova.

isIOS(): Boolean

Returns whether the OS is iOS.

isAndroid(): Boolean

Returns whether the OS is Android.

isAndroidPhone(): Boolean

Returns whether the device is Android phone.

isAndroidTablet(): Boolean

Returns whether the device is Android tablet.

isIPad(): Boolean

Returns whether the device is iPad.

isBlackBerry(): Boolean

Returns whether the device is BlackBerry.

isOpera(): Boolean

Returns whether the browser is Opera.

isFirefox(): Boolean

Returns whether the browser is Firefox.

isSafari(): Boolean

Returns whether the browser is Safari.

isChrome(): Boolean

Returns whether the browser is Chrome.

isIE(): Boolean

Returns whether the browser is Internet Explorer.

isEdge(): Boolean

Returns whether the browser is Edge.

isIOS7above(): Boolean

Returns whether the iOS version is 7 or above.

Discussion

Need Help?

If you have any questions, use our Community Forum or talk to us via Gitter chat. The Onsen UI team and your peers in the community will work together to help solve your issues.

For bug reports and feature requests use our GitHub Issues page.