Annonymous
Annonymous

Reputation: 23

How to do https://youtube.com into an Iframe NOT a video but youtube itself

I am trying to put YouTube into my HTML5 site. I am using iframe to do so but I do not want to just put a video in it, I want to put YouTube itself into it. I want to be able to search and watch videos in that iframe. With Google you can do,

<iframe src="https://www.google.com/search?igu=1" width="65%" height="60%" ></iframe>

and it will allow you to visit Google in an iframe. I want to do this but with YouTube.

I have already tried researching this but everyone just asks how to do videos. I have tried,

https://www.youtube.com/results?search_query=

but this does not work either.

<iframe src="https://www.youtube.com/" height="60%" width="65%" ></iframe>

This is the width and height that I want to have on the YouTube iframe. You will notice that it is rejected.

Upvotes: 0

Views: 331

Answers (1)

defq0n
defq0n

Reputation: 79

If you check the web console on the page with the iframe, you will see that that YouTube has a header 'X-Frame-Options' set to 'sameorigin' which will not allow you to use it in an iFrame from a third-party website.

Full message:

Refused to display 'https://www.youtube.com/' in a frame because it set 'X-Frame-Options' to 'sameorigin'.

Upvotes: 1

Related Questions