How to mute an iframe?

安稳与你 提交于 2019-12-19 05:35:32

问题


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


回答1:


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>


来源:https://stackoverflow.com/questions/25354184/how-to-mute-an-iframe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!