Identify the type of environment in which the application is running, such as iPhone, Facebook, Windows, or iGoogle.
A constant that identifies the type of environment. Values are defined in the WL.Environment variable in the worklight.js file...
- WL.Environment.PREVIEW (when the application runs in Preview mode)
- WL.Environment.WINDOWS_PHONE (Windows Phone 7)
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.