Lightning experience OR classic view, where am I? | Techila
2115
single,single-post,postid-2115,single-format-standard,ajax_updown_fade,page_not_loaded,,qode_grid_1300,footer_responsive_adv,hide_top_bar_on_mobile_header,qode-content-sidebar-responsive,qode-theme-ver-9.4.2,bridge,wpb-js-composer js-comp-ver-4.12,vc_responsive
 

Lightning experience OR classic view, where am I?

LIGHTNING EXPERIENCE OR CLASSIC VIEW

Lightning experience OR classic view, where am I?

Have you ever faced a problem of identifying in which experience user is opening your page (VFP)? Is it lightning or classic?

Well, here is the solution to it. There are two ways:

1) Via Apex

public boolean isLightningExperience()

{

 if(Apexpages.currentPage().getParameters().get(‘sfdcIFrameOrigin’) != null)

        return true;

 return false;

}

2) Via JS on visualforce page

function isLightningExperience()

{

  if(‘{!$Currentpage.parameters.sfdcIFrameOrigin}’ != ”)

  return true;

  return false;

}

You can use two parameters to check this ‘sfdcIFrameOrigin’ and ‘istdp’. Now you can easily identify in which experience the user is via your code and can manipulate the functionality accordingly.

Courtesy: http://forceguru.blogspot.in/2016/09/lightning-experience-or-classic-view.html

“Know more about Salesforce Consulting at Techila”

Author: techila

No Comments

Post A Comment