I created a LWC which displays a link to an object… and I want that link to "open in a new window" (target "_blank") if the user is viewing it via standard navigation view (non-console). And, if the user is viewing the LWC within Service Console, then it should utilize standard open (NavigationMixin.Navigate) to open in the current window (which will default to opening a new tab within Console).
I can't seem to find a way for the LWC to be aware of it's context – whether or not it is being displayed in Console. Is this possible?
(I can provide the LWC; however, I don't think the details of it are relevant to the question, but if it helps someone answer the question I can.)
Best Answer
At the current time, LWC are not supported in the Console. You'd need to put a LWC inside an Aura Component Wrapper in order to use one within the Console. See the LWC Developer Documentation for more on this.
To do what you're asking, you'd also need to implement the Lightning Console JavaScript API in your component. If you've not migrated to the Lightning Console, I wouldn't expect the toolkit for the classic console to work with LWC's.