IBM Worklight v5.0.5 > API reference > IBM Worklight client-side API > JavaScript client-side APIWL.Client.getEnvironment
Identify the type of environment in which the application is running, such as iPhone, Facebook, Windows, or iGoogle.
WL.Client.getEnvironment()
Return Value
A constant that identifies the type of environment. Values are defined in the WL.Environment variable in the worklight.js file...
- WL.Environment.ADOBE_AIR
- WL.Environment.ANDROID
- WL.Environment.EMBEDDED
- WL.Environment.FACEBOOK
- WL.Environment.IGOOGLE
- WL.Environment.IPAD
- WL.Environment.IPHONE
- WL.Environment.MOBILE_WEB
- WL.Environment.OSX_DASHBOARD
- WL.Environment.PREVIEW (when the application runs in Preview mode)
- WL.Environment.VISTA_SIDEBAR
- WL.Environment.WINDOWS_PHONE_8
- WL.Environment.WINDOWS_PHONE (Windows Phone 7)
- WL.Environment.WINDOWS8
When an app is running in Preview mode, this method returns WL.Environment.PREVIEW, regardless of the previewed environment...
- Environment-specific code can fail when invoked from the browser (because the environment might support features that are not available in the browser).
- WL.Client behaves differently in different environments (for example, cookie management).
A good practice is to rely on the IBM Worklight UI optimization framework and separate environment-dependent JS to separate files rather than using the WL.Client.getEnvironment() function.
Parent JavaScript client-side API