2017-05-04 131 views
0

您好我使用codeigniter和bootstrap开发一个网站,然后在我的管理页面中上传YouTube网址,并使用iframe和加载该网址在我的视图页中获取该网址。但YouTube视频没有显示当我检查网站上的错误显示像拒绝在我的网站上显示YouTube视频

拒绝在该框架中显示“https://www.youtube.com/watch?v=7Ct59FQIbAU”,因为它设置“X-框架 - 选项”到“SAMEORIGIN”。 广告:522 GET https://www.youtube.com/watch?v=7Ct59FQIbAU网:: 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> 
+0

YouTube只允许非常特定的网址嵌入其他网站。他们会在每个视频页面上为您提供该URL。 – ceejayoz

+0

@ceejoz,为您的评论...但我无法清楚地了解 – pixel

回答

4

当你嵌入视频,你不该't COPYPASTE选项卡上的视频网址。

你应该做这样的事情

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

enter image description here


当我看到你的代码有这样的事情

enter image description here

我在想,它是如何在你的本地主机上工作的? :/

+0

这是一个cms网站,我在我的管理页面添加视频网址,只是在我的视图区域调用该网址...如果我使用正常编码,它的工作正常... – pixel

相关问题