Monday, December 9, 2019

How To Check Whether User In Lightning Experience Or Classic Experience In LWC

Please use the below code in your LWC components under the java script controller.

ExperienceCheck.js
import {api,wire, track} from 'lwc';
export default class ExperienceCheck
{
 checkTheExperience(event)
 {
  if(document.referrer.indexOf(".lightning.force.com") > 0)
  {
   console.log('user in lightning experience');
  }
  
  else
  {
   console.log('user in classic experience');
  }
 }
}


Hope this helps you..Enjoy..!

No comments: