Skip to content

Commit 1de8add

Browse files
authored
Merge pull request #132 from sandiegopython/davidfischer/additional-youtube-sandboxing
YouTube Sandboxing for privacy
2 parents ab8f708 + c46fe62 commit 1de8add

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

pythonsd/templates/pythonsd/fragments/recent-videos.html

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
{% if recent_videos %}
22
{% with most_recent_video=recent_videos|first %}
33

4+
{% comment %}
5+
In addition to running the "privacy" domain for YouTube (youtube-nocookie),
6+
we are sandboxing YouTube to prevent it from setting cookies among other things.
7+
The "allow-popups" flags allow people to hit the "Watch on YouTube" button
8+
on the video player which navigates users to YouTube.
9+
10+
See:
11+
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#sandbox
12+
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#allow
13+
{% endcomment %}
414
<div class="embed-responsive embed-responsive-16by9 w-75">
5-
<iframe class="embed-responsive-item" src="https://www.youtube-nocookie.com/embed/{{ most_recent_video.id }}" title="YouTube video player" frameborder="0" allow="autoplay; encrypted-media; picture-in-picture; web-share" allowfullscreen></iframe>
15+
<iframe class="embed-responsive-item" src="https://www.youtube-nocookie.com/embed/{{ most_recent_video.id }}?html5=1" title="YouTube video player" frameborder="0" sandbox="allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox allow-presentation" allow="autoplay; encrypted-media; picture-in-picture; web-share" allowfullscreen></iframe>
616
</div>
717

818
{% endwith %}

0 commit comments

Comments
 (0)