【发布时间】:2019-06-05 21:23:39
【问题描述】:
我正在制作一个网站,我想在我的页面刷新时加载一个 MP3 文件,但不知何故它无法播放。
<body>
<audio id="kofi" autoplay="autoplay">
<source src="kofi.mp3" type="audio/mp3">
</audio>
<script type="text/javascript">
window.onload = function(){
document.getElementById('kofi').play(); // On this line I get error "Uncaught (in promise) DOMException"
}
</script>
<body>
【问题讨论】:
标签: javascript