Page 1 of 1

force visitors to first click on my social media handle link before activating a link or download

Posted: Tue Jul 09, 2024 5:47 am
by vintoICT

I want force visitors to first click on my social media handle link before activating a link to a page or download button.

if(condition)
     disableLink();
else
   showLink();



function disableLink()
        {

        document.getElementById('Link1').disabled=true;
        document.getElementById('Link1').removeAttribute('href');    
        document.getElementById('Link1').style.textDecoration = 'none';
        document.getElementById('Link1').style.cursor = 'default';
        }

        function showLink()
        {
            document.getElementById('Link1').disabled=false;
        //assign href dynamically
        document.getElementById('Link1').href = "somepage.html";
        document.getElementById("Link1").style.textDecoration = "underline";
        document.getElementById("Link1").style.cursor = "hand";
        }

but i want the link disabled only if the user's browser have not visited.