我正在将<audio>
标签插入页面。这在 Mac 上的 Chrome 和 Safari 中运行良好,但在 Windows 中的 Chrome 和 Safari 上都插入了标签,但从不播放音频。我已将代码精简到最低限度,现在它非常简单。我只是不知道为什么 Windows 很难。
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>
test
</title>
<script type="application/x-javascript" src="js/jquery-1.4.2.min.js" charset="utf-8"></script>
</head>
<body>
<script type="application/x-javascript">
$('body').html('<audio src="./audio/myfile.mp3" autoplay></audio>');
</script>
</body>
</html>
有趣的是,如果我删除所有 JS 并将<audio>
标签插入到 中<body>
,Chrome Win 可以工作,但 Safari Win 仍然不能。有点次要问题,但 Safari Win 是否需要 QuickTime(当前未安装)才能使用<audio>
标签?