I have a django template that displays a list of objects with youtube videos:
{% for obj in objs %}
<h1>{{ obj.name }}</h1>
<iframe width="425" height="349" src="{{ obj.video}}" frameborder="0" allowfullscreen=""></iframe>
{开发者_如何学编程% endfor %}
obj.video
is stord as a urlField. When I load the page chrome console gives me the error refused to display document because display forbidden by x-frame-options
.
The problem persists if I replace {{ obj.video }}
with a manually written youtube embed url such as http://youtu.be/zzfQwXEqYaI
. However, if I replace it with something like www.google.com
the iframes will load.
Try embedding the video like with url like:
http://www.youtube.com/embed/zzfQwXEqYaI
I guess its some kind of protection from youtube
精彩评论