• Andry

    (@blackstar1991)


    Can you answer how to add this script on amp pages ?

    var allLikeLink = document.querySelectorAll("button[data-href]");
    	for(var i=0; i<allLikeLink.length; i++){
        allLikeLink[i].addEventListener("click", function(){
        var link = this.getAttribute('data-href')
         if (link === "a") {
                link = 'https://www.google.com/';}
            window.open(link, '_blank');
        }, false);
        
    }

    I read about amp-iframe but don’t found support in plugin

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    Can you please let me know why do you want to add this script in AMP? Please let us know your use-case, we will study it and help you accordingly.

    Thread Starter Andry

    (@blackstar1991)

    I use buttons on my site, they won’t be indexing like links. These buttons just need redirect users to other pages. But i have a lot of buttons on a page. So i need component that can help me with my problem.

    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    Adding a custom script will cause validation issues, which is why it is not allowed to add custom scripts.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add custom JS on all amp pages’ is closed to new replies.