Open link in a new tab — JavaScript

Using <a> tag

<a href=”http://noteshub.co.in/" target=”_blank”>Open Link in New Tab</a>

THROUGH A FUNCTION

openInANewTab(link) {
window.open(link, “_blank”);
}

--

--

--

Programmer and a voracious reader who writes about web development | adityatyagi.com

Love podcasts or audiobooks? Learn on the go with our new app.

All about localStorage in JS

Using TypeScript with Styled-Components

A simple introduction to sorting algorithms

Upload files and Images to Firebase and retrieve a downloadable URL

Hyperlink Icon

How to block third party scripts with a few lines of javascript

Building a Budget Manager with Vue.js and Node.js (Part II)

How to test an Angular 13 Service

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aditya Tyagi

Aditya Tyagi

Programmer and a voracious reader who writes about web development | adityatyagi.com

More from Medium

Angular vs. React: Which One is Best for Your Business?

Why Developers Should Use the WebP Image Format Instead of JPEG or PNG

Generate TypeScript Declaration Files for JavaScript Files

The JavaScript logo with an arrow pointing towards the TypeScript logo

Server-Side Events as Simple Alternative to WebSockets