Determining the Salesforce Style That Users See in JavaScript
If you use a lot of JavaScript in your pages and apps, identifying the Salesforce theme that a user sees in JavaScript code is important. Identifying the current user experience context allows you to correctly manage navigation in your JavaScript code.
The UITheme.getUITheme() JavaScript function returns a string containing one of the following values to identify the current user interface theme.
Theme1—Obsolete Salesforce themeTheme2—Salesforce Classic 2005 user interface themeTheme3—Salesforce Classic 2010 user interface themeTheme4d—Modern “Lightning Experience” Salesforce themeTheme4t—Salesforce mobile app themeTheme4u—Lightning Console themePortalDefault—Salesforce Customer Portal themeWebstore—AppExchange theme
The string values returned are the same values returned by the Visualforce $User.UITheme and $User.UIThemeDisplayed global variables.
The following markup checks if the current user experience context is the Lightning Experience theme.
See Also