0

Good afternoon. On the site (for example) nnmclub.to have some ad units in the iframe. How to implement a click on them?

I clicked on the part of the href links (links are kind of like http: //site.xyz) click on .xyz. But it opens the same source site and not link that was clicked on. That is, clicks but returned nnmclub.to.

Options are tried

  1. <script>
        window.onload = function() {
          document.querySelector('a[href*=".xyz"]').click(); 
        }
    </script>
    

    2.

    window.onload = function() {
        var links = document.getElementsByTagName("a");
        for (var i = 0; i < links.length; i++) {
          var link = links[i].getAttribute('href');
          if (link.indexOf('.xyz') !== -1) {
            links[i].click();
            break;
          }
        }
    } 
    
Maulik Savaliya
  • 1,262
  • 7
  • 17

0 Answers0