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
  • 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
    Commented Nov 25, 2016 at 15:03

1 Answer 1

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';
1
  • 2
    var isSF1 = typeof sforce !== 'undefined'
    – sfdcfox
    Commented Nov 25, 2016 at 16:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .