I have a custom LWC that has a link on it for a customers website. It should open a new tab in the web browser with the companies website. It currently opens a new link with a salesforce url prefix.


Website Value: google.com

On Click: lightning.force.com/lightning/r/Lead/00Q5500000Bf9T9EAJ/google.com

Code Snippet:

                           <dt class="slds-dl_horizontal__label slds-text-title">Website:</dt>
                            <dd class="slds-dl_horizontal__detail">
                                <p if:true={accountWebsite}>
                                    <a href={accountWebsite} target="_blank">Company Website</a>
    get accountWebsite(){
        return getFieldValue(this.account.data, 'Account.Website');

The odd thing is that I am 99.99% sure that this was working a few months ago. I know that there have been a couple of API version and changes to LWC, so I am not sure if that might be a cause.

Anyone insight would be greatly appreciated.


  • Can you do something like below: <a class="social-icons" href="facebook.com" target="_blank" rel="noopener noreferrer"</a>
    – nica
    Commented Dec 31, 2020 at 0:49

1 Answer 1


Due to your website format (google.com), it'll function as a relative URL which makes it root-relative and uses the domain of the page as the prefix (as you noted).

You need to add a forward slash to your field as in one of the following prefixes to make it an absolute URL.

  1. http://www.google.com
  2. https://google.com

This is highlighted in the lightning-formattedURL doc describing relative vs. absolute URLs

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .