Click on the link to open it in a new tab using Vue

Recently, I encountered an issue while trying to open a link in another tab using the target="_blank" method.

This is what I attempted:

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

However, upon clicking the anchor tag, instead of being redirected to the desired link, users were directed to a URL like this:

https://partner-stage.smiledirectclub.com/www.elly.com

Answer №1

Follow these steps:

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

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Refresh the array object following a personalized filter

I am currently using a custom filter to aggregate a $scope object within an ng-repeat block. Here is my code snippet: $scope.myobj = isSelected ? $filter('customFilter')($scope.origObj) : $scope.origObj In the above code, $scope.myobj is util ...

What is the best way to represent the amount of water consumed from milliliters in a visual

I need assistance in displaying the calculated amount of cups using cup icons. Keep in mind that one icon represents 220 ml. My objective is to reach 3.60 liters of water intake. This equates to approximately 16.36 cups. Is there anyone who can assist me ...

Uploading pictures to Imgur without the need for an API key

I've been attempting to utilize the imgur API feature that allows you to upload an image by sending a GET request to http://api.imgur.com/2/upload with a URL in the form data. However, I have been unsuccessful in making it work as intended, as it simp ...

REACT Issue: Unable to Select Dropdown Option with OnChange Function

I have a component that includes a select element. Upon clicking an option, the OnProductChange function returns the value. However, my e.target.value shows as [Object Object]. Yet, {console.log(product)} displays: {id: 1, name: "VAM"} Clicking on Add L ...

Having trouble with submitting a Vue.js form when toggling the visibility of a bootstrap panel?

There are three bootstrap panels that are displayed depending on the selection made in the select element: <div class="panel panel-default"> <Select/> </div> <div class="panel panel-default" v-if="fileMode == 0"></div> <d ...

Is using float:right making the jquery slide toggle dropdown div (triggered by hover) appear glitchy?

Utilizing jQuery's slidetoggle and hover functions, I have successfully implemented a dropdown feature in my div. Within this div, there is various information displayed including the date, a note counter, and three buttons. The first two are Tumblr ...

Does the antialias feature fail to function on certain devices with webGL renderer?

Antialiasing appears to function properly on my MacBook Pro when using Chrome. Unfortunately, when viewing the same code on my iPhone 6s with either Chrome or Safari, the antialiasing does not work correctly. ...

Vue component functions failing to execute

I've recently started exploring Vue and encountered an issue with a component's "mounted" method not triggering. Despite thorough checks for errors or warnings, and reviewing the code multiple times, I can't seem to pinpoint the problem. Str ...

`The resurgence of CERT_FindUserCertByUsage function in JavaScript`

I am currently grappling with unraveling the connection between C++ dlls and JavaScript. There is a snippet of js code that reads: cert = CERT_FindUserCertByUsage(certDB, certName.nickname,certUsageEmailSigner, true, null); where the variable cert is ini ...

Error sending an email through the EmailJS backend JavaScript file

I am in the process of creating a route for my backend JavaScript Express server called server.js that will trigger an email to be sent to my Gmail account using EmailJS. When I attempt to use the following code: const SMTPClient = require("emailjs& ...

Traverse through an array of elements within a React component

I will be receiving data from an API and storing it in a state object that appears like the following: constructor(props) { super(props); this.state = { searchable: false, selectValue: 'day-to-day-banking', clearable: false, data: { ...

Do Not Replace Bootstrap Theming

Good day, I am encountering an issue that has left me puzzled. I am attempting to modify the color scheme of bootstrap using SCSS in my Vue project, but it seems to be ineffective when I execute npm run serve. Below are snippets from my files: custom_boo ...

The Battle of Brainpower: Smarty vs. JavaScript/AJAX

One question I have is: Is there a specific guideline or convention for determining when to use "Smarty templating" versus using JavaScript Ajax calls to generate content? I have the ability to generate content dynamically using Ajax/JavaScript calls. Whi ...

Vue.js - v-for not automatically updating when assigning a new array is not functioning

I've been going through a Vue.js tutorial on YouTube: Vue.js Tutorial: Beginner to Front-End Developer https://www.youtube.com/watch?v=1GNsWa_EZdw&t=48s Most of the tutorial has been working fine for me, except for the issue with updating the nav ...

What is the best way to have the slide shift to the left solely after the initial click and prevent it from moving left on subsequent clicks?

Is there a way to prevent the slide area from scrolling left when the left button is clicked before it has been scrolled right first? Additionally, how can we lock the scroll after it reaches the last div? var $slider = $("#recent-container") $("#right ...

Step-by-step guide on incorporating play/pause buttons for two distinct Bootstrap 5 carousels

I have been struggling to incorporate carousel controls on my website. I have tried looking at various examples on different platforms, like Stack Overflow, but I am only able to get one set of controls to work at a time. Here is my current setup: ...

Mastering the art of styling strings in the Terminal with Chalk - the ultimate guide

I've been trying to use the chalk terminal string styling package in iTerm2, but I'm not seeing any colored string results despite following all the installation steps. Even a simple console log like console.log("hello"); in my chalk.js file isn& ...

Add array as an element within another array

After initializing the data, I have an object structured like this and I am able to push data using the method below: myObj = { 1: ["a", "b", "c"], 2: ["c", "d", "e"], } data: { types: {} }, methods: { pushValue(key, value) { var ...

The Kendo Grid is refusing to show up within the popup window

I am new to using Angular 2 and Kendo UI. Currently, I am attempting to include a grid inside my pop-up window. While I have successfully displayed the pop-up, adding the grid has proven challenging. The grid is not appearing as expected ...

Utilizing the dnd library to incorporate drag and drop functionality

I've encountered an issue with the code snippet below. Although I am able to drag elements, I am unable to drop them. How can I trigger the dropFunction when a drop occurs? Drag code: <div> <a class="button" ng-class= ...