Embedding youtube video "Refused to display document because display forbidden by X-Frame-Options"
The page you're setting as the source of the iframe (the Youtube /watch
page) doesn't want to be embedded in your page. You cannot force it to let you do that.
The correct URL to embed is of the form:
http://www.youtube.com/embed/oHg5SJYRHA0
When you copy a video link off YouTube: "https://www.youtube.com/watch?v=Fva3fgKmu3o"
Replace 'watch' with 'embed'
Remove '?v='
Final Example: "https://www.youtube.com/embed/Fva3fgKmu3o"
Replace the keyword watch?v= with embed and change the live URL something like this:-
$url_string="https://www.youtube.com/watch?v=H1pTkatn6sI";
$url= str_replace('watch?v=','embed/', $url_string);
And then embed it in the iframe
<iframe id="player" type="text/html" width="640" height="390" src="{{ $url }}" frameborder="0"></iframe>