YouTube iframe shows forbidden error on blogspot page and webpage - html

I am trying to show a youtube video on my webpage and Blogspot page using HTML iframe.
<iframe width="320" height="250" src="http://youtube.com/watch?v=Y4lqtiYLuJU"></iframe>
But it's giving me the following forbidden error :
This website does not permit its contents to be displayed in a frame, it must be opened in a new window.
I am getting the same error on Blogspot when posting this iframe code to my Blogspot page.
Is there any way to fix this?

YouTube iframes works over HTTPS
<iframe width="320" height="250"
src="https://www.youtube.com/embed/Y4lqtiYLuJU">
</iframe>

Related

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.
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'.

Youtube Video not showing in a web page when embed using iframe?

I want to embed a Youtube video on my website. I have tried the following code but it does show the video or any controllers:
<iframe width="400" height="300"
src="https://www.youtube.com/watch?v=z-QgsXkYqjc"
frameborder="1"
allowfullscreen></iframe>
Anyone know what I am doing wrong?
Much appreciated.
Change the src to this:
src="https://www.youtube.com/embed/z-QgsXkYqjc"

Youtube video not showing in iframe

I am very ignorant in this area. I wanted to embed a video in my website. I just went on w3schools and copy-pasted the example code.
<iframe width="420" height="315"
src="http://www.youtube.com/embed/XGSy3_Czz8k?autoplay=1">
</iframe>
Why does the video than not show in the website? I am using Google Chrome.
EDIT:
The problem was that I was using the real youtube address instead the URL for embedding.
it's actually works perfectly, checkout the other code, may be the iframe is hidden by any other controls

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

This question already has answers here:
Embedding youtube video "Refused to display document because display forbidden by X-Frame-Options"
(10 answers)
Closed 5 years ago.
I am trying to feed my Django page with some resource I am getting from somewhere else.
Inside the feed, I have YouTube videos with URL like: https://www.youtube.com/watch?v=A6XUVjK9W4o
Once I added this into my page, the video does not 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:
How can I get this to work?
I am showing it in HTML like this:
<iframe width="420" height="315"
src="{{vid.yt_url}}">
</iframe>
I googled almost for an hour, but no sign of success. I tried to append &output=embed - nada...
You must ensure the URL contains embed rather 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>
The YouTube URL in src must have and use the embed endpoint instead of watch, so for instance let’s say you want to embed this YouTube video: https://www.youtube.com/watch?v=P6N9782MzFQ (browser's URL).
You should use the embed endpoint, so the URL now should be something like https://www.youtube.com/embed/P6N9782MzFQ. Use this value as the URL in the src attribute inside the iframe tag in your HTML code, for example:
<iframe width="853" height="480" src="https://www.youtube.com/embed/P6N9782MzFQ" frameborder="0" allowfullscreen ng-show="showvideo"></iframe>
So just replace https://www.youtube.com/watch?v= with https://www.youtube.com/embed/ and of course check for your video's ID. In this sample, my video ID is P6N9782MzFQ.
You only need to copy <iframe> from the YouTube Embed section (click on SHARE below the video and then EMBED and copy the entire iframe).
If embed no longer works for you, try with /v instead:
<iframe width="420" height="315" src="https://www.youtube.com/v/A6XUVjK9W4o" frameborder="0" allowfullscreen></iframe>
Along with the embed, I also had to install the Google Cast extension in my browser.
<iframe width="1280" height="720" src="https://www.youtube.com/embed/4u856utdR94" frameborder="0" allowfullscreen></iframe>

Create link to my website embedded video and start playing

I have the following video iFrame embed code on a page on my website (mywebsite.com/page2) - it plays a video that is hosted on an external site (http://wistia.com). I want to be able to send email clients a link to my video on my page (mywebsite.com/page2/mywebsitevideolink) - not a link to the external website, a link that opens up mywebsite.com/page2 and displays the video on my page that you would have to scroll down to see and starts playing it. How can this be accomplished? Thanks.
<p class="rtecenter"><iframe allowfullscreen=""
allowtransparency="true" class="wistia_embed" frameborder="0"
height="480" mozallowfullscreen="" msallowfullscreen=""
name="wistia_embed" oallowfullscreen="" scrolling="no"
src="//fast.wistia.net/embed/iframe/myvideo" webkitallowfullscreen=""
width="640"></iframe></p> "
Modify your p tag to <p class="rtecenter" id="video">and then your link is http://mywebsite.com/page2#video
Hope that this'll help you.
You can also set up a file which displays when you type /page2/mywebsitevideolink and redirects to /page2#video
If you want to link to a certain part of your page, just use an anchor link.
<div name="videopart">
VIDEO HERE
</div>
And for the link: http://yoursite.com/video.html#videopart
And for the player to autoplay, if you are using your video hosting's player, look in teir documentation for how to autoplay. If your just using the html tag, and the word autoplay in the beginning tag.