embed youtube video - Refused to display in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN' [duplicate]

匿名 (未验证) 提交于 2019-12-03 01:52:01

问题:

I am trying to feed my django page with some resource I am getting from somewhere else.

inside feed, I have youtube videos with url like: https://www.youtube.com/watch?v=A6XUVjK9W4o

once I added this into my page, video doesnot show up saying:

Refused to display 'https://www.youtube.com/watch?v=A6XUVjK9W4o' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

Then I said, well, what if I change watch to embed. Then youtube player shows up, but no video, saying:

does anyone have a clue how I get this to work?

I am showing in html like this:

 

I googled almost for an hour, no sign of success. I tried to append &output=embed.. nada..

回答1:

Try it, please

 


回答2:

Youtube url in src must have embed so for instance lets say you want to share this youtube video https://www.youtube.com/watch?v=P6N9782MzFQ you should use https://www.youtube.com/embed/P6N9782MzFQ as url in src's iframe HTML code, for example:

So just replace https://www.youtube.com/watch?v= to https://www.youtube.com/embed/ and of course check for your video's ID in this sample my video ID is P6N9782MzFQ



回答3:

You only need to copy from youtube Embed section (click on SHARE below the video and then EMBED and copy the entire iframe)



回答4:

If embed no longer works for you try with /v instead.

 


回答5:

Along with the embed, I also had to install the Google Cast extension in my browser.

 


易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!