Very rarely you might have to navigate the user from Lightning Web Components to an external URL. Out of the box, Salesforce provides a solution to that.

Let us look at a snippet on that.

import { LightningElement } from "lwc";

import { NavigationMixin } from "lightning/navigation";

export default class ExploreNavigation extends NavigationMixin(
  LightningElement
) {
  handleNavigate() {
    const config = {
        type: 'standard__webPage',
        attributes: {
            url: 'http://salesforcecasts.com'
        }
	};
    this[NavigationMixin.Navigate](config);
  }
}
Navigating a user to an external URL from LWC

The approach that we will be following is going to be as usual. We need to create a config object and pass it to the method this[NavigationMixin.Navigate].

In the config that we provide, we need to specify the type as standard__webpage and in attributes, we need to specify the external URL, the rest of everything will be taken care by the platform.

Hope that was helpful!