javascript - 为什么 html 音频自动播放不起作用

标签 javascript html

这是有bug还是什么?请帮我。我正在编写一个网站,但它不起作用。我使用谷歌浏览器。是否存在兼容性问题?

<audio autoplay id="myaudio" allow="autoplay">
<source src="http://soundbible.com/mp3/Fuse Burning-SoundBible.com-1372982430.mp3.mp3" type="audio/mpeg">
</audio>
<script> document.getElementById('myaudio').play(); </script>

最佳答案

您的网址似乎不起作用。删除一个 .mp3,它应该适合您。

<audio autoplay id="myaudio" allow="autoplay">
<source src="http://soundbible.com/mp3/Fuse Burning-SoundBible.com-1372982430.mp3" type="audio/mpeg">
</audio>
<script> document.getElementById('myaudio').play(); </script>

关于javascript - 为什么 html 音频自动播放不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51041053/

相关文章:

javascript - 如何让按钮在点击时显示内容?

jquery - 进度条上的后退按钮

javascript - 按钮中 onClick 绑定(bind)的正确方法

php - 带有扩展名 .html 的网页有易受攻击的 PHP 代码?

javascript - 使用 jQuery 在页面加载时淡入 Web 元素

javascript - d3 转换条形图

javascript - 打开和关闭菜单

javascript - 如何使用 Javascript 通过数据属性定位元素

javascript - Reactjs 的 If-Else 状态

html - mailchimp 3.0 以html形式获取模板