How to mute an iframe?

Haunt picture Haunt · Aug 18, 2014 · Viewed 17.6k times · Source

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

MD.MD picture MD.MD · Aug 18, 2014

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>