0

I'm trying to use NavigationMixin.GenerateUrl from an LWC to open a link to an external url e.g. https://google.com

The issue i am seeing is Salesforce opens a new window and appends my URL to the org e.g https://computing-inspiration-XXXX.scratch.lightning.force.com/lightning/webpage/https%3A%2F%2Fgoogle.com

Below is an extract from my LWC:

urlString = 'https://google.com';

this[NavigationMixin.GenerateUrl]({
type: 'standard__webPage',
attributes: {
    url: urlString.toString()
    }
}).then((url) => {
    window.open(url,'_blank');
});

Can anyone provide any guidance here? from the documentation / examples i have seen this should work.

2
  • How is this different from your previous question? Commented Nov 6, 2024 at 14:46
  • @DerekF different navigation method, different outcome due to using GenerateUrl that results in different error. Commented Nov 6, 2024 at 14:54

1 Answer 1

0

why are you complicating things. you can just use lightning-formatted-text and set your URL as value and set linkify=true or just add linkify.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.