Content Auto Clickable with Script

Asked

Viewed 223 times

2

Guys I’m trying to use a script to try to give an automatic Play in a Youtube video.

The closest I found was the script below.

This script does something close to what I need, but it just does it at 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 is instead of this script give an auto click on a link.

he gave an auto click on a content that was inside a div or iframe like this.

 <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?

  • 1

    Only normal youtube autoplay no longer serves? http://www.youtube.com/embed/LxLLgo4HVp8?autoplay=1

  • Actually no, iframe is an example of what would be the content that would be clickable

1 answer

4

That’s not gonna happen. In addition to misleading the purpose of the click (which ceases to be human, to be programmed), if the iframe is in another domain it is not possible to access its DOM and consequently click or fire events in this DOM.

  • Um... but the above script doesn’t exactly do that? only on a link? every 5 seconds it clicks on the link.

  • 1

    @Built the script you have redirects the page you run to whatever is in the variable linkPage. What you are looking for "to have an automatic Play in a Youtube video" is not possible since the video is in an iframe, makes a mistake -> Uncaught SecurityError: Failed to read the 'contentDocument' property from 'HTMLIFrameElement'

  • Look at this question I asked some time ago, http://answall.com/questions/66673/auto-click-do-mouse-em-um-conteudo-dentro-de-umadiv would be something like this

  • @Can Sergio help me help this user with this question? http://answall.com/questions/102884/sistema-em-joomla?noredirect=1#comment210416_102884

Browser other questions tagged

You are not signed in. Login or sign up in order to post.