问题与Wysihtml5和Iframe视频

Issue with Wysihtml5 and Iframe for videos

本文关键字:Iframe 视频 Wysihtml5 问题      更新时间:2023-09-26

使用https://github.com/xing/wysihtml5的wysihtml5,我一直在尝试添加一个自定义的方式来添加视频。我尝试了https://github.com/arvigeus/bootstrap3-wysihtml5/blob/master/src/bootstrap3-wysihtml5.js的实现,但当我目前遇到2个问题。

1)拒绝在帧中显示'https://www.youtube.com/watch?v=OOHYCZLmbyc',因为它将'X-Frame-Options'设置为'SAMEORIGIN'。

2)当我提交表单时,部分被忽略。

当我在文本区嵌入iframe的输出是:

<div class="embed-responsive embed-responsive-16by9">
  <iframe class="embed-responsive-item" src="https://www.youtube.com/watch?v=LzWmhO4zw7M" allowfullscreen="">
    #document
      <html>
         <head>
         </head>
      </html>
  </iframe>
</div>

当我提交表单时,日志中的输出是:

"文本" => "
"

其中"text"是我的数据库中的列名

我想出了一个解决办法:

1)在"/watch"之前添加"/v"解决了这个问题

我添加了一个脚本来改变url:

https://www.youtube.com/watch?v=OOHYCZLmbyc

https://www.youtube.com/v/watch?v=OOHYCZLmbyc

在我的上下文中,我添加了这个:

video.src = src["src"].replace("://www.youtube.com/watch", "://www.youtube.com/v/watch")

2)我在stackoverflow上找到了一个解决方案,建议修改wyshtml5脚本中的一行,以便它忽略解析器:

查看这里的解决方案:https://stackoverflow.com/a/17175438/834161