首页 > 解决方案 > 如何让 YouTube 自动播放为网站工作?

问题描述

我一直在尝试让客户在访问我的网站时自动播放 youtube 视频。我一直在环顾四周,发现 Google 禁用了该功能。无论如何都要编写一些代码,这样人们就不必手动启用它,或者手动单击它?我不是编码专家,所以请原谅我的无知

我的代码:

<!DOCTYPE html>
<html>
<head>
<style>
body {
    background-color: black;
}

h1 {
    color: white;
    text-align: center;
}

p {
    font-family: verdana;
    font-size: 20px;
}
</style>
</head>
<body>

<iframe width="560" height="315" src="https://www.youtube.com/embed/DkW87-Z9FAY?autoplay=1"></iframe>

</body>
</html>

标签: htmlyoutubeautoplay

解决方案


您设置什么并不重要,因为浏览器和用户已经设置了自己的偏好。


推荐阅读