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
Big EarsBig Ears 

$User.UIThemeDisplayed not working - Inline VF page in Lightning Record Page

I have an inline Visualforce page in the Contact record which I'm viewing in Chrome. Sometimes the page loads and it recognises it is in Lightning and other times it doesn't. I have put the "$User.UITheme" and "$User.UIThemeDisplayed" variables into the page to see where it thinks it it:
VF page with UITheme merge fields

In both cases, the VF page thinks that it is in Salesforce Classic. Is there any chance this is a bug?
Best Answer chosen by Big Ears
Alain CabonAlain Cabon
Hello,

If you have several opened tabs and you swith to Classics in only one tab, you will have the Classics User.UITheme for all the tabs at the next refresh (the user object has only one field for this switch).

Style Existing Visualforce Pages with Lightning Experience Stylesheets​ (v41 Winter 18):
<apex:page lightningStylesheets="true">
http://Style Existing Visualforce Pages with Lightning Experience Stylesheets

 

All Answers

Alain CabonAlain Cabon
Hello,

If you have several opened tabs and you swith to Classics in only one tab, you will have the Classics User.UITheme for all the tabs at the next refresh (the user object has only one field for this switch).

Style Existing Visualforce Pages with Lightning Experience Stylesheets​ (v41 Winter 18):
<apex:page lightningStylesheets="true">
http://Style Existing Visualforce Pages with Lightning Experience Stylesheets

 
This was selected as the best answer
Big EarsBig Ears
Alain,

You're absolutely rigjht - thanks! I was using lightningStylesheets="true" and was seeing my styling move back and forth and couldn't work out why. But I was working in multiple tabs and moving back and forth between classic and lightning and not realising this was impacting multiple tabs.

Andy