How to open a link in a new tab, not a new window, using JavaScript?
Hello everyone! I'm a beginner frontend developer and I've encountered a problem that seems simple, but I can't solve it.
I need that when a button on my site is clicked, a link opens in a new browser tab. I'm using the `window.open()` method:
```javascript
function openLink() {
window.open('https://example.com');
}
```
But the problem is that this works differently in different browsers. In Firefox and Chrome, the link opens either in a new tab (which is what I need) or in a new popup window. Moreover, sometimes this popup window is blocked by the built-in popup blocker. Users complain that nothing happens.
I've read that you can use the `target="_blank"` attribute in the `` tag, but I need to open the link programmatically via