0

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'.

This is the configuration made for the tab

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 am not able to find the exact cause of this

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.

0 Answers0