javascript
open link in new tab using javascript
window.open('https://devsheet.com', '_blank');
If you want to open a link in a new tab using javascript only you can use window.open() javascript method which will open link in a new tab if you pass the second parameter as '_blank' in window.open() method.
This is equivalent to appying target="_blank" to <a> tag to open link directly using HTML.
Was this helpful?
Similar Posts
- Use jQuery to check if a tab is active/inactive
- Create a tab component in React
- Navigate or link to another page React
- Add new item at first position of array using unshift() method Javascript
- Remove new line separator from start and end positions of string in Javascript
- Define a new component in Vue.js
- Convert all characters to lowercase using toLowerCase() method in javascript