I've got an HTML file that embeds a Youtube video using an iFrame. However before the video starts loading, I need to pass it an URL, since the iFrame just acts as a container.
Is it possible to do it with Javascript?.
I've got an HTML file that embeds a Youtube video using an iFrame. However before the video starts loading, I need to pass it an URL, since the iFrame just acts as a container.
Is it possible to do it with Javascript?.
Check this example if it's meeting your requirements
<iframe id="custom-frame" src="/test.html"></iframe>
<p>Click the button to change the value of the src attribute in the iframe </p>
<button onclick="changeFrame()">Try it</button>
<script>
function changeFrame() {
document.getElementById("custom-frame").src = "http://www.facebook.com";
}
</script>