微信网页中音频自动播放实现
在html中的body标签之后加入以下代码即可(亲测有效)
</body> <audio id="audio2" src="../5c1b983cbc844.mp3" preload="" autoplay="autoplay" loop="loop" ></audio> <script type="text/javascript"> function audioAutoPlay(id) { var audio = document.getElementById(id); audio.play(); document.addEventListener( "WeixinJSBridgeReady", function() { audio.play(); }, false ); } audioAutoPlay("audio2"); </script> </html>