Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Determining the Salesforce Style That Users See in JavaScript
The UITheme.getUITheme() JavaScript function returns a string containing one of the following values to identify the current user interface theme.
- Theme1—Obsolete Salesforce theme
- Theme2—Salesforce Classic 2005 user interface theme
- Theme3—Salesforce Classic 2010 user interface theme
- Theme4d—Modern “Lightning Experience” Salesforce theme
- Theme4t—Salesforce mobile app theme
- Theme4u—Lightning Console theme
- PortalDefault—Salesforce Customer Portal theme
- Webstore—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.
1function isLightningDesktop() {
2 return UITheme.getUITheme === "Theme4d";
3}