Search code examples
javascriptvideoembed

Refused to display 'http://vimeo.com/27577981' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'


I am trying to embed a video in embed tag But I am getting this error :

Refused to display 'http://vimeo.com/27577981' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

for youtube link : http://www.youtube.com/watch?v=zBEYR69o2Ao when i replace watch?v= with embed/ , it runs fine. But its is not necessary that video will be of youtube. So I want a unique solution for this.


Solution

  • As the error message says, you can't embed that page in a frame. Vimeo provide documentation on how to embed their player. Follow that.

    <html>
    <head>
      <title>{page_title}</title>
    </head>
    <body>
      <iframe src="https://player.vimeo.com/video/{video_id}" width="{video_width}" height="{video_height}" frameborder="0" title="{video_title}" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
    </body>
    </html>