I add a YouTube video to the training slides I made by Prismic. It shows the first video but from the second to the end, it returns the following error (on Chrome):
Refused to display 'https://www.youtube.com/' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
On the Firefox, instead of the video plays, the following error shows:
To protect your security, www.youtube.com will not allow Firefox to display the page if another site has embedded it.
and let me click on a button that opens the link of the YouTube video and plays the video on the YouTube channel instead of my website. Is there any suggestion to fix the error?
Welcome to the Prismic community.
I believe this is not an issue from the Prismic side. The reason for this is that Google is sending an "X-Frame-Options: SAMEORIGIN" response header. This option prevents the browser from displaying iFrames not hosted on the same domain as the parent page.
I believe, You must ensure the URL contains embed rather than watch as the
/embed endpoint allows outside requests, whereas the
/watch endpoint does not.
<iframe width="420" height="315" src="https://www.youtube.com/embed/A6XUVjK9W4o" frameborder="0" allowfullscreen></iframe>
Give this a try and let me know.
Thank you for the quick response.
The solution should logically work, but it doesn’t. I did all the suggestions and solutions available on the other websites and none of them work.
The videos are available to embed and the embed link is copied from YouTube that contains ‘embed’.
Is there any suggestions to solve this problem?
Can you please send me the link that you are using?
Sure! Following is the entire code with the link:
<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/m1mHOcNilag?rel=0&showinfo=0" allowfullscreen></iframe>
I appreciate your help!
Your solution is working. The problem was that I changed the link of the slide that was not used in the code. Thank you!
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.