Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
YouTube embeds
colak wrote #340743:
I seem to be having a total block on this but I’m also having another more major issue with YouTube embeds…
There appear to be a lot of complaints that youtube embeds return errors instead of loading. This could be because of copyrighted material but also because youtube has updated their html for embeds. To save some grief to those who may have the same issue, I am posting here the minor changes I did to suppress the errors and get the videos to load.
<iframe
loading="lazy"
referrerpolicy="strict-origin-when-cross-origin"
src="https://www.youtube-nocookie.com/embed/[video_ID]"
allow="autoplay; encrypted-media; gyroscope; picture-in-picture; web-share"
allowfullscreen>
</iframe>
The additions are the referrerpolicy
and the web-share
although the literature for the later does not give any clues as to why it is needed as its functionality is to just add the share button on the video.
The errors for me may have appeared because I have
Header always set Referrer-Policy "strict-origin-when-cross-origin"
in my htaccess which I have kept untouched. I read that adding the referrerpolicy
in the iframe
overrides the htaccess directive just for those iframes.
Note that I do not know for how long this was happening as, in spite of my witnessing the errors in other sites, I normally work on our site without enabling the video cookies.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Pages: 1