html - 在 <audio> 中隐藏上下文菜单

标签 html css html5-audio

我正在为我儿子创建一个 php 程序,我在其中使用组件音频。但我想阻止他使用上下文菜单下载音频文件。

属性控件显示或隐藏所有内容,所以这不是我需要的。我想要比 javascript 函数更简单的东西。

我是这样用的:

<audio controls src="music.wav"></audio>

最佳答案

您可以添加 controlsList="nodownload"<audio>隐藏下载按钮的标签(至少在 Chrome 上)

<div class="positionRelative">
  <audio controls src="https://ccrma.stanford.edu/~jos/wav/viola.wav" controlsList="nodownload"></audio>
  <div class="styleAudio"></div>
</div>

关于html - 在 <audio> 中隐藏上下文菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57270330/

相关文章:

javascript - 使用 jquery 将 RenderPage 插入到 div 中

html - 是否可以在 CSS 中使用 % 设置 HTML5 音频播放器的大小?

HTML5 验证错误 : Element source not allowed as a child element of audio in this context

PHP 文件包含一般查询

html - 在移动设备上放大时出现 Div 滚动问题

javascript - 无需点击提交即可将表单转换为 Javascript

html - 我可以在 css 中设置最大宽度吗?

html - CSS - 垂直居中

javascript - 如何将样式仅应用于 HTML 中的一个 div?

html - 高效地传输音频并保持大范围的静音