I need to mute an iframe but I don't know how can I do it. Here is an example of what I'm saying:
[url]http://www.codecademy.com/es/bitAce74593/codebits/nW7U9b[/url]
Here you can hear the music from the website on the iframe, I need to automaticaly mute that audio.
Hope that someone knows how to do it.
Thanks
I don't think it's possible.
[QUOTE=Darkwater124;45720395]I don't think it's possible.[/QUOTE]
Theres no javascript that can do that?
You can't access other sites through iframes. It's a security measure. Imagine loading up google.com and stealing account data that way.
[QUOTE=Darkwater124;45720464]You can't access other sites through iframes. It's a security measure. Imagine loading up google.com and stealing account data that way.[/QUOTE]
I don't want to steal any data, I just want to load a website on an iframe without the audio
[QUOTE=alrynec;45720488]I don't want to steal any data, I just want to load a website on an iframe without the audio[/QUOTE]
The API you want also allows for stealing data and other malicious activity. That's why it doesn't exist.
[QUOTE=Darkwater124;45720654]The API you want also allows for stealing data and other malicious activity. That's why it doesn't exist.[/QUOTE]
So there's no way to just block the sound incoming? What about muting my website so the iframe won't play sound
[QUOTE=alrynec;45720732]So there's no way to just block the sound incoming? What about muting my website so the iframe won't play sound[/QUOTE]
Why are you using iframes in the first place anyways
[QUOTE=Killervalon;45725509]Why are you using iframes in the first place anyways[/QUOTE]
Because I need to show another website on my site, but without the audio. Sometimes the site I need to display has ads with audio and that's really annoying.
[editline]18th August 2014[/editline]
Someone told me that I can mute it by js, example:
[I]<script type="text/javascript">
myVid=document.getElementById("video1");
myVid.muted=true;
</script>[/I]
[I]<iframe width="820" height="390" src="http://nyan.cat" id="iframeId"></iframe>[/I]
I've tried and this didn't work, also I found that adding style="volume: silent;" to the iframe will mute it but this didn't work.
Anyone knows another possible way to do that?
As I told you earlier, you can't access other sites through an iframe. The element playing audio is inside the iframe. You can only manipulate the iframe itself, and you can't mute iframes. The CSS volume property does not exist (yet). What you're asking for is impossible.
[QUOTE=Darkwater124;45728500]As I told you earlier, you can't access other sites through an iframe. The element playing audio is inside the iframe. You can only manipulate the iframe itself, and you can't mute iframes. The CSS volume property does not exist (yet). What you're asking for is impossible.[/QUOTE]
Ok so last question, could my website to be muted? So no audio from iframe or anything will be played.
Nope.
this is as best as you're going to get it.
it disables sound but also disables the script to hide the language bar, so its a double edged sword.
[code]
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<iframe sandbox="allow-scripts" width="820" height="390" src="http://nyan.cat" id="video1"></iframe>
</body>
</html>
[/code]
[QUOTE=Silentfood;45731538]this is as best as you're going to get it.
it disables sound but also disables the script to hide the language bar, so its a double edged sword.
[code]
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<iframe sandbox="allow-scripts" width="820" height="390" src="http://nyan.cat" id="video1"></iframe>
</body>
</html>
[/code][/QUOTE]
Thanks you saved me! This actually works quite well
Sorry, you need to Log In to post a reply to this thread.