This question has been flagged
2 Replies
4412 Views

We're using the website builder (v13) with the Advantage Theme and are trying to embed Youtube and Vimeo video's. Based on a previous search of the forum we have found the following HTML code that seems to correctly embed a Youtube video.

<div class="embed-responsive embed-responsive-16by9">

   <iframe width="560" height="315" src="https://www.youtube.com/embed/tY7vaistEsw">

   </iframe>

</div>


If we then replace the Youtube generated iframe with the following for Vimeo, the HTML editor does not allow saving the HTML, i.e., assuming there's an error.

<div class="embed-responsive embed-responsive-16by9">

    <div style="padding:57.42% 0 0 0;position:relative;">

       <iframe src="https://player.vimeo.com/video/449642714" style="position:absolute;top:0;left:0;width:100%;height:100%;" frameborder="0" allow="autoplay; fullscreen" allowfullscreen>

        </iframe>

    </div>    

    <script src="https://player.vimeo.com/api/player.js"></script>

</div>

Does anyone know how to embed Vimeo video's correctly?

Thanks, Paulo
Avatar
Discard
Best Answer

If you use one of the Odoo 3rd party HTML snippet modules, you could insert the HTML snippet on a page and it should accept and format your code properly. There are free and paid modules for this.

Avatar
Discard
Author

Hi Bruce,

Could you please point me to such app(s) because all I have been able to find is apps for Youtube videos, and I doubt that they will work by simply replacing the Youtube iframe or URL with a Vimeo as I have experienced.

I have used the free Website HTML Snippet at https://apps.odoo.com/apps/modules/13.0/website_snippet_html/. You would install it on Odoo and then drag the snippet onto a page and paste your code into it.

Author

Thanks Bruce!

Best Answer

You cannot display a lot of websites inside an iFrame. Reason being that they send an "X-Frame-Options: SAMEORIGIN" response header. This option prevents the browser from displaying iFrames that are not hosted on the same domain as the parent page.

I faced the same error when displaying YouTube links. For example: https://www.youtube.com/watch?v=8WkuChVeL0s

I replaced watch?v= with embed/ so the valid link will be: https://www.youtube.com/embed/8WkuChVeL0s

It works well. (Reason : /embed has the required header)

Try to apply the same rule on your case.

Why is X-Frame-Options

It is there for user security. Prevents clickjacking : https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options

The embed endpoint is desinged to be safer to show on external websites (not youtube.com).

SAMEORIGIN

The page can only be displayed in a frame on the same origin as the page itself. The spec leaves it up to browser vendors to decide whether this option applies to the top level, the parent, or the whole chain, although it is argued that the option is not very useful unless all ancestors are also in the same origin.

http://net-informations.com/q/mis/youtube.html

Avatar
Discard