Build a Video Display Using iframe

Published: (January 14, 2026 at 11:15 AM EST)
1 min read
Source: Dev.to

Source: Dev.to

Overview

After completing a couple of theory lessons on working with the iframe element, I moved on to the Build a Video Display Using iframe workshop from freeCodeCamp. The exercise starts with a simple HTML boilerplate and gradually introduces new attributes for the iframe element.

Adding the Heading

The first step was to add a heading with the text iframe Video Display.

Creating the iframe

An “ element was then created and the src attribute was set to the supplied YouTube URL.

Configuring the allow Attribute

In lesson six, the allow attribute was expanded to include:

  • encrypted-media – enables encrypted media extensions for protecting the video.
  • gyroscope – grants access to device sensors.
  • web-share – allows sharing of the iframe content through native share dialogs.

The full allow value now reads:

accelerometer autoplay clipboard-write encrypted-media gyroscope picture-in-picture web-share

Setting referrerpolicy

The penultimate exercise required adding the referrerpolicy attribute with the value strict-origin-when-cross-origin. This controls the information sent in the Referer header when navigating from the page to the iframe.

referrerpolicy="strict-origin-when-cross-origin"

Enabling Full‑Screen Playback

Finally, the allowfullscreen attribute was added so the video can be viewed in full‑screen mode.

allowfullscreen

Conclusion

The workshop introduced several new concepts—such as configuring the allow attribute, using referrerpolicy, and enabling full‑screen playback—that will be reinforced in the next lab, Build a Video Compilation Page.

Back to Blog

Related posts

Read more »

Build a List of Major Web Browsers

Overview After grinding through two sets of fairly heavy theory lessons over the weekend and writing about them, it was a relief to get back to a freeCodeCamp...

Build an HTML Media Player

Build an HTML Video Player Over the course of the last couple of days I've completed another workshop and lab via freeCodeCamp. I undertook the Build an HTML V...

Build a Video Compilation Page

Moving on from the previous workshop, the next lab on the Responsive Web Design certification at freeCodeCamp had me building a video compilation page. The lab...

Fundamentals of react app

Introduction Today we’re going to look at the reasons and uses of the files and folders that are visible when creating a React app. !React app structurehttps:/...