Auto Clickable Content with Script

2

Personal I'm trying to use a script to try to give an automatic play on a Youtube video.

The next thing I found was the script below.

This script does something close to what I need, but it just does this on some link.

 <script type = "text/javascript">

  window.setTimeout("autoClick()", 5000); // 5 seconds delay

  function autoClick() {
  var linkPage = document.getElementById('ads-container').href;
  window.location.href = linkPage;
   }
  </script>  


 <a href="" id="ads-container"> Dynamic Link </a>

What I would like to do instead of this script is to click on a link.

It gave an auto click on a content that was inside a div or Iframe like that.

 <iframe width="560" height="315" src="https://www.youtube.com/embed/YBHQbu5rbdQ"frameborder="0" allowfullscreen></iframe>

Does anyone have any idea how to do this?

    
asked by anonymous 08.12.2015 / 22:47

1 answer

4

This will not be possible. In addition to fooling the purpose of the click (which stops being human, to be programmed), if the iFrame is in another domain it is not possible to access the DOM and consequently click or trigger events in that DOM.

    
08.12.2015 / 22:53