<video> 标签和自动播放属性:如何让它在生产环境中发挥作用?

<video> tag and autoplay attribute: How to make it work on production?

我正在尝试在 Prestashop 1.7 上嵌入带有 autoplay 的视频集。我正在使用带有以下代码的默认编辑器:

<div class="owl-item" style="width: 100%;">
  <video width="100%" height="600" autoplay>
    <source src="/img/cms/myvideo.mp4" type="video/mp4"> Your browser does not support the video tag.
    </source>
  </video>

我一发布它,似乎 Prestashop 只是编译没有 autoplay 属性的代码。我注意到其他基于 php 的代码也会发生这种情况。我不知道如何避免它,也不明白为什么。

有什么想法吗?谢谢!

PrestaShop 使用名为 'HTMLPurifier' 的库清除文本区域中可能存在的 'bad' html,从而允许您将文本也插入为 html。 该库清除可疑标记(或属性),如 iframe、自动播放、脚本等。

通常禁用它可以解决保存后标签或标签属性消失的问题:)

尽情享受