function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ssoftwaressoftware 

User.UITheme does not work

Hi All,

Created the following simple visualforce page, and then a tab based on this page. Enabled lightning experience and then visited the tab (App Launcher -> Other Items -> this tab). The option "Available for Salesforce mobile apps and Lightning Pages" is also enabled.

The output shows Theme3 instead of Theme4d. What am I doing wrong?

<apex:page showHeader="true" >
{!$User.UITheme}
<br/>
{!$User.UIThemeDisplayed}
</apex:page>
 
Best Answer chosen by ssoftware
David HalesDavid Hales
Hi, the below workaround code worked for me to differentiate between Classic & Lightning UI.
<apex:page showHeader="true" sidebar="true">
    <apex:outputPanel rendered="{!$User.UITheme == 'Theme3'}">Currently in Classic UI</apex:outputPanel><br/>
    <apex:outputPanel rendered="{!$User.UITheme != 'Theme3'}">Currently in Lightning Experience UI</apex:outputPanel>
</apex:page>

If the above suggestion worked, let us know by marking the answer as "Best Answer" right under the comment which will help the rest of the community should they have a similar issue in the future.

Thanks & Regards 
David Hales(1044)