Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
isConsoleNavigation() for Lightning Experience
To determine if a component is using console navigation with LWC, see IsConsoleNavigation context wire adapter.
Arguments
Aura Components Sample Code
This component has a button that, when pressed, prints whether the current app is using console navigation.
Component code:
1<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
2 <lightning:workspaceAPI aura:id="workspace" />
3 <lightning:button label="Is Console Navigation?" onclick="{! c.handleIsConsoleNavigation }" />
4</aura:component>Controller code:
1({
2 handleIsConsoleNavigation : function(component, event, helper) {
3 var workspaceAPI = component.find("workspace");
4 workspaceAPI.isConsoleNavigation().then(function(response) {
5 console.log(response);
6 })
7 .catch(function(error) {
8 console.log(error);
9 });
10 }
11})Response
If the current app uses console navigation, this method returns a promise that resolves to true when successful, or false otherwise.