【问题标题】:Refuse to display youtube videos in my website [duplicate]拒绝在我的网站上显示 youtube 视频 [重复]
【发布时间】:2017-10-02 14:26:12
【问题描述】:

您好,我使用 codeigniter 和 bootstrap 开发了一个网站,我在我的管理页面中上传了 youtube url,并使用 iframe 在我的视图页面中获取该 url 并加载该 url。但是当我检查网站时,youtube 视频没有显示,错误显示如下

拒绝在框架中显示“https://www.youtube.com/watch?v=7Ct59FQIbAU”,因为它将“X-Frame-Options”设置为“sameorigin”。 广告:522 GET https://www.youtube.com/watch?v=7Ct59FQIbAU net::ERR_BLOCKED_BY_RESPONSE

当我检查这个网站时,网址显示但视频没有显示..这是该网站的网址www.clicx.in/pixelerror

在我的本地服务器上它的工作

查看代码是

<div class="container">
<div class="row">
<?php foreach($advertisement as $ad) { ?>
<!-- 4:3 aspect ratio -->
<div class="embed-responsive embed-responsive-4by3">
  <iframe class="embed-responsive-item" src="<?php echo $ad->url?>"></iframe>
</div> 
<?php }?>
    </div>  
</div>

【问题讨论】:

  • YouTube 只允许将非常具体的 URL 嵌入其他网站。他们会在每个视频页面上为您提供该 URL。
  • @ceejoz 那你的评论......但我不能清楚地理解

标签: php html codeigniter twitter-bootstrap-3 youtube


【解决方案1】:

当您嵌入视频时,您不应在标签上使用COPYPASTE 视频网址

你应该这样做

<iframe width="560" height="315" src="https://www.youtube.com/embed/7Ct59FQIbAU" frameborder="0" allowfullscreen></iframe>


当我看到你的代码时,有这样的东西

我想知道它是如何在您的本地主机上工作的? :/

【讨论】:

  • 这是一个 cms 网站,我在我的管理页面中添加了视频网址,然后在我的视图区域中调用该网址...如果我使用正常编码,它工作正常...
猜你喜欢
  • 2016-09-17
  • 2012-09-18
  • 1970-01-01
  • 2019-08-14
  • 2013-05-16
  • 1970-01-01
  • 1970-01-01
  • 2013-01-06
  • 1970-01-01
相关资源
最近更新 更多