Open link in another tab when you click button

Asked

Viewed 771 times

1

I already know how to open in another window, want when I close it, update my site!

Her code is this:

<a href="https://www.blogger.com/blogger.g?blogID=811315793714916374#" onclick="window.open('http://bit.ly/loga-se','pagename','resizable,height=260,width=370'); return false;" style="font-size: xx-large;" target="_blank"><img border="0" src="https://1.bp.blogspot.com/-K_dSSmrPEjI/V_ZrScV1fdI/AAAAAAAAA_U/gJyCpyJT47c4Y4dYkB99_I_sxf4_X2q_gCLcB/s1600/bt.PNG" /></a>

quando fechar essa janela atualizar meu site!

  • I don’t know what its purpose is to open a new window, but it would be much more practical if you show the content in a modal, because from it it becomes easier to assign actions to your page that originated it.

2 answers

0

See if this solves !

<a href="https://www.blogger.com/blogger.g?blogID=811315793714916374#" class="link" style="font-size: xx-large;">
    <img border="0" src="https://1.bp.blogspot.com/-K_dSSmrPEjI/V_ZrScV1fdI/AAAAAAAAA_U/gJyCpyJT47c4Y4dYkB99_I_sxf4_X2q_gCLcB/s1600/bt.PNG" />
</a>

<script>

document.querySelector('.link').addEventListener('click', function(e){
    e.preventDefault();
    var win = window.open('http://google.com', 'pagename', 'resizable,height=260,width=370');
    var popupTick = setInterval(function() {
        if (win.closed) {
            clearInterval(popupTick);
            console.log('window closed!');
            // window.location.reload(true);
        }
    }, 500);
    return false;
});

</script>

0

Hello, maybe what you want is the attribute window.close()

This attribute will update a described page every time you close the page by the button.

see if this solves:

onclick="window.open('http://bit.ly/loga-se','pagename','resizable,height=260,width=370'); return false; window.close(https://www.blogger.com/blogger.g?blogID=811315793714916374#)"

I hope it helps you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.