Skip to content

YouTube Sandboxing for privacy #132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion pythonsd/templates/pythonsd/fragments/recent-videos.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
{% if recent_videos %}
{% with most_recent_video=recent_videos|first %}

{% comment %}
In addition to running the "privacy" domain for YouTube (youtube-nocookie),
we are sandboxing YouTube to prevent it from setting cookies among other things.
The "allow-popups" flags allow people to hit the "Watch on YouTube" button
on the video player which navigates users to YouTube.

See:
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#sandbox
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#allow
{% endcomment %}
<div class="embed-responsive embed-responsive-16by9 w-75">
<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>
<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>
</div>

{% endwith %}
Expand Down
Loading