4

Is there a way to identify whether the user is using Lightning Experience or classic? I have been using "UserInfo.getUIThemeDisplayed()" and it used to give me value of "Theme3" for classic and "Theme4d" for Lightning Experience. Now it is giving me "Theme3" for both. Is there any other attribute which helps me determine the Lightning Experience Vs Classic. Winter '17 Salesfroce

User in Lightning Experience.

Apex Code.

system.debug(UserInfo.getUIThemeDisplayed());
system.debug(UserInfo.getUITheme());

System Debug, enter image description here

  • 1
    Can you clarify how your apex code is being invoked? For example, using Lightning Out in Visualforce page that is rendered in Lightning Experience will still say the displayed theme is Classic because the context is the Visualforce page, not the one/one.app – Doug Ayers Nov 25 '16 at 15:03
3

This sounds like a bug to me although I have not tested it myself. Try opening case with support on this.

The other way would be to look for sforce.one context variable using JavaScript .Inside lightning experience context variable Sforce will be true.

var isSF1 = typeof sforce !== 'undefined';
  • 2
    var isSF1 = typeof sforce !== 'undefined' – sfdcfox Nov 25 '16 at 16:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.