doubts about target="_ blank"

0

When I use target="_ blank" it opens a new tab and focuses on it I just want it to open a new tab but focus continues to the current page.

    
asked by anonymous 12.05.2018 / 14:40

1 answer

1

But you have to do this using javascript , only the link will not do it. Change your link to include a call to a function like this:

<a href="endereço-da-janela" target="_blank" onclick="return abrirJanela(this))">

Then in function you open the window and return focus to the current window:

function abrirJanela(link) {
    var novaJanela = window.open("about:blank", link.target, "width=500,height=500");
    novaJanela.blur();
    window.focus();
    novaJanela.location.href = link.href;
    return false;
}
    
12.05.2018 / 14:48