htmlcsswebweb-content

Redirecting old page


Whenever someone leaves my site by clicking on a link to another site on my website the link opens in a new tab on desktop or a new window on mobile. I was wondering when that new tab opens whether once there not viewing the old tab it could go onto another page automatically, like a thank you page with the social media links.

Hope that makes sense,

Thanks


Solution

  • I'm not sure, have I understood your question but probably you need something like this http://jsfiddle.net/zyhrs5j4/

    <a href="https://www.google.com/" target="_blank" onclick="javascript:goToThanksPage()">Google</a>
    

    EDIT:

    Base on our comments, here is code which I made after inspect your page, and it will add on click function on each link:

    <script>
    var links = document.querySelectorAll(".feed-item a");
    for(var i = 0; i < links.length; i++){
        links[i].onclick = function() {
            location.href="/mypage.html";
        }
    }
    
    
    
    </script>