I want to load a website in Lightning itself, instead of opening the link in a new browser tab.
I have created a quick action that calls a LWC(myNavigation) on click of it. The LWC is then embedded in lightning tab named 'External_Website'.
Here is my code I have written in LWC:
import { LightningElement, api, track } from 'lwc';
import { NavigationMixin } from 'lightning/navigation';
export default class MyComponent extends NavigationMixin(LightningElement) {
@api async invoke(){
console.log('Executed...');
var externalUrl = 'https://www.salesforce.com';
this[NavigationMixin.Navigate]({
type: 'standard__navItemPage',
attributes: {
apiName: 'External_Website'
},
state: {
url: externalUrl
}
});
}
}
The problem is when I click the quickaction, a new tab is opening but their is no content loaded in it.
I have kept the HTML file of LWC empty as I don't need any customization. I just want to load website in the tab as it is.