Javascript 中的音频静音?
我坐在这里想知道是否可以编写一个greasemonkey 脚本来检测payperclick 等网站并将音频静音,这样就听不到广告。
我意识到我可以通过简单地通过greasemonkey脚本删除广告文本来以更好的方式完成同样的事情,但出于好奇,我想知道是否可以通过javascript禁用音频。
I was sitting here wondering if it's possible to write a greasemonkey script that would detect sites like payperclick and mute the audio so the ad isn't heard.
I realize that I could accomplish the same thing in a better fashion by simply removing the ad text through a greasemonkey script but for purposes of curiousity, I wondered if you can disable the audio through javascript.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我能够看到这种情况的唯一方法是:
1) 广告有自己的“静音按钮”,它调用 JavaScript 函数...在这种情况下,您可以自己调用该函数。
2) 广告用于音频的插件有一个 javascript API(与 1 相同)
3) 仅限 IE:一些奇怪的 IE ActiveX 东西可能可以做到这一点......通过访问它可能不应该访问的东西。
所有这些我都认为非常可疑
任何其他可能性对于 javascript 来说都太低级而无法访问(或者至少我认真希望情况如此)。 浏览器本身没有音量控制......所有多媒体都是通过插件完成的。
The only way I can see this being possible is if:
1)the ad has its own "mute button" which called a javascript function...in which case you could just call that function yourself.
2) The plugin the ad is using for audio has a javascript API (same as 1)
3) IE only: some bizarre IE ActiveX thing that could probably do it...by accessing stuff that it probably shouldn't.
All of these I consider extremely doubtful
Any other possibility would be too low level for javascript to have access to (or at least I seriously hope that is the case). A browser by itself has no volume controls....all multimedia are done by plugins.
除了完全剥离
Other than completely stripping the <embed> element, it's a no-go; JavaScript simply doesn't have the power to access the volume controls of Flash media... yet. : )
您可以尝试删除
embed
元素上的 autostart 属性或将其设置为 false。You could try removing the autostart attribute on the
embed
element or setting it to false.也许是问题,通过控制浏览器......也许会在某些浏览器中产生一些不兼容,但不会破解,并且仅通过用户选择控制浏览器或键盘
maybe the aswer, pass by control the browser.... maybe something that generat some incompatility in some browsers but not hack, and only controlling the browser or keyboard by user choice