I’m working on a streamer website and would like to embed twitch clips using the iframe tag. I’m using node.js with express for my backend, if that helps. However, I am getting an error that displays as so:
[Refused to display ‘https://clips.twitch.tv/’ in a frame because it set ‘X-Frame-Options’ to ‘sameorigin’.]
You showed iFrame code not JS code.
So I’m assuming you did the iFrame and the JS didn’t work.
And this isn’t the generated iFrame from inspector but your HTML from view source.
Nethertheless, need the actual code you used an the link to your web page with the code on to investigate.
None of that generates an iFrame or the JS to render a iFrame as per the Embed docs.
Given additionally that the Clips Emebds doesn’t use the Embed JS lib anyway. (Which I forgot so there is no JS to auto attach a parent when embedding clips)
So your generated HTML is missing the required parent .
I have been trying to understand the docs for this for some time. I followed the Non-Interactive IFrames for Clips section since that was my intended target. Which is what I have right now.
I do not remember seeing any requirements in the docs for front end js to get the iframes working. If I missed that could you point me to the section it states that, thank you.
You are missing a &parent=exmample.com from the iframe src where example.com would be your domain
Your claim here only applies whe using embed everywhere, the JS Lib Twitch provides for embedding live streams and vods but NOT clips. For clips you have to add the parent manually.
Docs are specically
Iframe Attributes
Name
Type
Description
allowfullscreen
boolean
If true, the player can go full screen.
clip
string
A globally unique string called a slug, by which clips are referenced.
height
number or string
Height of the embedded window, in pixels. This can be expressed as a percentage, by passing a string like 50%. Recommended minimum: 300.
parent
string
(required) Domain(s) that will be embedding Twitch. You must have one parent key for each domain your site uses.
Where parent is appened to the iFrame src (rather than an attribute) as per the example
Thank you, that got it to work. I initially had the parent in there but the embed still didn’t work. I guess there were multiple issues. Well now it works. Thanks again