Hello
I have a button which when clicked, opens a site in a new tab (e.g. Facebook.com).
However, I also want the current tab to redirect to another page of my site, e.g. a ‘Success’ page.
I setup the button link to open in a new tab, and it works great, however, when I add my code, it overrides this and ONLY opens the page I want (‘/success’) in the current tab.
I have this code:
<script>
var BTN_1 = document.getElementById('cta');
//Do Something
function pageRedirect() {
window.location.href = "/success";
}
BTN_1.onclick = pageRedirect; //Start action on click
</script>
Is there anything I can add / tweak above, in order to allow me to redirect in the current tab AND open the link I wanted in a new tab?