Alrynec Alrynec - 4 months ago 49
HTML Question

How to mute an iframe?

I need to mute an iframe, but I don't know how to do it. Here is an example of what I have:

http://www.codecademy.com/en/bitAce74593/codebits/nW7U9b

Here you can hear the music from the website on the iframe, I need to automatically mute that audio.
Hope that someone knows how to do it.
Thanks

Answer

you can mute it by js, example: just put this in your page:

<script type="text/javascript">
    myVid=document.getElementById("video1");
    myVid.muted=true;
</script>

you should replace "video1" by the id of your iframe, if the iframe don't have any id add an id to it as follow:

<iframe width="820" height="390" src="http://nyan.cat" id="iframeId"></iframe>
Comments