user755806
user755806

Reputation: 6815

Embedding video in an iframe?

I have below code to embed video. but it is not working. Any suggestions?

<!DOCTYPE html>
<html>
<body>

<iframe src="https://vimeo.com/63534746"></iframe>

</body>
</html>

Upvotes: 1

Views: 2807

Answers (2)

blex
blex

Reputation: 25634

The link you used leads to the video's page, not to the video "embedding" page. You can use the "share" feature of the site to get the right iframe code:

enter image description here

Upvotes: 2

Matthew Darnell
Matthew Darnell

Reputation: 4588

The error you get back in the console is Refused to display 'https://vimeo.com/63534746' in a frame because it set 'X-Frame-Options' to 'sameorigin'. so Vimeo is blocking you from doing what you are trying to do.

There are three possible values for X-Frame-Options:

DENY - The page cannot be displayed in a frame, regardless of the site attempting to do so.

SAMEORIGIN - The page can only be displayed in a frame on the same origin as the page itself.

ALLOW-FROM uri - The page can only be displayed in a frame on the specified origin.

Instead of embedding that whole page, you can use the embed code provided by Vimeo (found by clicking the 'Share' button).

<iframe src="https://player.vimeo.com/video/63534746?color=ffffff" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<p>
    <a href="https://vimeo.com/63534746">Light Bikes</a> from <a href="https://vimeo.com/ericcorriel">Eric Corriel</a> on <a href="https://vimeo.com">Vimeo</a>.
</p>

Upvotes: 2

Related Questions