1。所以我想将controlist="nodownload"
更改为controlist="download"
使用Javascript加载页面后。
<html>
<body>
<audio id="preview"controls=" " controlist="nodownload"
<source src="horse.mp3" type="audio/ogg">
</audio>
</body>
</html>
2.my javascript:
window.onload = function() {
var x = document.getElementsByid("preview");
x.setAttribute("controlist", "download");
}
这不起作用,因此您可以纠正我的错误以使其起作用。[Violation] 'load' handler took 23639ms
[Violation] 'setTimeout' handler took 73ms
[Violation] 'visibilitychange' handler took 762ms
更改为:
window.onload = function() {
var x = document.getElementsByid("preview");
x.setAttribute("controlslist", "download");
}
至:
window.onload = function() {
var x = document.getElementsByid("preview");
x.setAttribute("controlist", "download");
}
您写错x.setAttribute("controlist", "download");
示例:
window.onload = function() {
var x = document.getElementById("preview");
x.setAttribute("controlist", "download");
}
<html>
<body>
<audio id="preview"controls=" " controlist="nodownload"
<source src="horse.mp3" type="audio/ogg">
</audio>
</body>
</html>