I need to javascript a link that opens a page in a new tab and redirects the current page to another link.
I need to javascript a link that opens a page in a new tab and redirects the current page to another link.
HTML:
<a href="https://www.google.com.br" target="_blank" id="xx">abrir em nova janela</a>
JS:
document.getElementById('xx').addEventListener('click', function(){
location.replace('https://pt.stackoverflow.com');
});