Vue.js <button> opening a new tab

Search for a command to run...

Sweta Something that I find useful for these sorts of things is to search in your search engine the language you are working with (in this case, JavaScript) followed by your intended action. It takes a little tinkering to learn what keywords to use all the time, so expect a little practice. I ended up searching for "js open link in same tab" which helped me solve the issue
Matt Dean I have tried using '_self', window.location.replace, window.location.href, window.location.assign all did not work for opening the link in the same tab. '_self' is opening current page what is opened in website but not the respective page of the link after clicking on the link. Kindly provide some other solution.
Sweta I believe this topic may not currently align with the focus of this blog (I suggest conducting research to determine if others have attempted this with the same JS framework you are using). Additionally, there are multiple factors that could impact the desired functionality you are seeking. It would be advisable to incorporate console logs and debugger statements in order to gain a thorough understanding of any deficiencies, whether they may involve errors or incorrect logic.
In this series, expect some detailed blogs on useful snippets or coding procedures that I find useful for my day-to-day life as a web developer!
In the world of web development using C#, the Response.Redirect method is a common way to guide users to different pages within a web application. However, there's a glaring issue that we need to address: the second parameter, which introduces unnece...
In the world of web development using C#, the Response.Redirect method is a common way to guide users to different pages within a web application. However, there's a glaring issue that we need to address: the second parameter, which introduces unnece...

Ever need to trap the focus of the browser to a modal, a tour guide, or something else while trying to balance accessibility? I am far from an expert, but one thing I found on StackOverflow that helped me was this snippet from Shane McCurdy from th...

The Intro We had a dilemma today of an issue found in our code that needed to be fixed. After some time hunting I was able to find a distinct "this is good" reference in time and a distinct "this is not good" reference - but had no idea which commit ...

Introduction Ideally - we want our components to be kinda "dumb". Mostly just displaying data or gathering input from the user - the front end components shouldn't be smart enough to know what to do with said info once they have it. Usually this mea...

Before I Start You can find the podcast episode around this topic below! Introduction I shall begin with a quick story of something I went through this past week. I had a task to create analytics events for a few new key features that we wanted to ...

One thing I found difficult in remembering how to do was making a button in VueJS act as an <a> tag and open a link via a new tab. Fortunately, this was way easier than I thought!
<button @click="gotoLink()">
Click me!
</button>
methods: {
gotoLink() {
window.open('https://workingunittests.com', '_blank');
}
}