1

I'd like to click on an embedded youtube video using javascript (so the video plays automatically). I successfully simulated a click on a <div> like this:

function f(){
    alert("hello");
}

<div id="someid" onmouseup="f();">
    my text
</d>

document.getElementById("someid").onmouseup();

How can the above code be adapted to work with an embedded youtube video?

SundayMonday
  • 19,147
  • 29
  • 100
  • 154

2 Answers2

2

Just add &autoplay=1 to the link of the video in the <embed> tag.

Alex
  • 32,506
  • 16
  • 106
  • 171
2

If he does what you suggest the views on the embedded video won't count. I'm pretty sure he is asking his question because he is trying to find a way to get the video to autoplay and have youtube count the views at the same time.

Johnny B.
  • 21
  • 1