Skip to content

Open link in anothoer tab vue

I’m trying to open a link in another tab like we always do with target="_blank"

I’m doing this:

<div v-if="webPage" class="practice-item__web-page">
   <a :href="webPage" target="_blank">
      {{ webPage }}
   </a>
</div>

But when the users clicks in the anchor tag they are not redirect, the anochor tag add the link to the url of the website like this https://partner-stage.smiledirectclub.com/www.elly.com

Answer

Do this: –

<div v-if="webPage" class="practice-item__web-page">
   <a :href="'http://' + webPage" target="_blank" rel="noopener noreferrer">
      {{ webPage }}
   </a>
</div>