+ Start a Discussion
Kanwalpreet SinghKanwalpreet Singh 

Apex how to check view is Salesforce Classic or Lightning.

Hi,

How i can check on controller if page is opened using 'Salesforce Classic' or 'Salesforce lightning' UI(for winter 16 release).

Thanks,
Kanwalpreet Singh
ShashankShashank (Salesforce Developers) 
I'm sure this will help you: http://bobbuzzard.blogspot.com/2015/11/context-is-everything.html
Anas LABRITIAnas LABRITI
with javascript you can do that :
    
        if(document.referrer.indexOf(".lightning.force.com") > 0){
            alert("welcome to lightning ");
        }else{
            alert("welcome to classic");
        }
narsavagepnarsavagep
FYI: This is now built in: https://developer.salesforce.com/blogs/isv/2016/04/introducing-ui-theme-detection-for-lightning-experience.html