Shopify / liquid

Liquid markup language. Safe, customer facing template language for flexible web apps.

Home Page:https://shopify.github.io/liquid/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`external_video_url` doesn’t update the `origin` URL parameter for YouTube videos

nikitaourazbaev opened this issue · comments

The external_video_url filter doesn’t update the origin URL parameter for YouTube embeds when using a preview URL. This is a URL parameter that the filter generates automatically. The origin mismatch breaks messaging to and from the iframe on preview URLs. The filter also includes the country part of the URL, breaking embed interaction on non-native-language stores.

Passing an explicit value to it with something like external_video_url: origin: request.origin doesn't seem to affect the output, the parameter is ignored.

This is also affecting us and causing support debt.

Referencing Google's documentation - https://developers.google.com/youtube/player_parameters#origin

you should always specify your domain as the origin parameter value

Shopify is not passing the correct domain, and not only the domain.


To show an example, here's what that this filter creates on a French version of a store:
<iframe frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="allowfullscreen" class="js-youtube" loading="lazy" src="https://www.youtube.com/embed/qV5lzRHrGeg?autoplay=1&amp;controls=1&amp;enablejsapi=1&amp;loop=0&amp;modestbranding=1&amp;origin=https%3A%2F%2Fmy-dev-store.myshopify.com%2Ffr&amp;playlist=qV5lzRHrGeg&amp;playsinline=1&amp;rel=0" title="Multiple videos"></iframe>

This should not have "%2Ffr" at the end:
origin=https%3A%2F%2Fmy-dev-store.myshopify.com%2Ffr