FNJ

Why Embedding a YouTube or Vimeo Video Costs More Than You'd Think

A single embedded video iframe brings along cookies, an unload handler, and enough JS weight to move your Lighthouse score by double digits.

PublishedJuly 20, 2026
Read time2 min
Written byThe Framer → Next.js team
All posts ↗

Embedding a video feels like adding one element to a page. Technically, it's importing a small application — and that application has its own cost, independent of anything the site owner controls.

What actually loads when you embed a video

A Vimeo or YouTube embed isn't a video file with a play button — it's a full iframe pointing at that provider's own player application: their own JavaScript bundle, their own CSS, their own analytics/cookie logic, sometimes megabytes of it, loaded the moment the iframe itself loads (independent of whether the video is actually played).

The specific costs we measured

Third-party cookies. The player sets its own cookies the moment it loads, which Lighthouse's Best Practices audit flags directly.

An unload handler you don't control. Both major video platforms' player scripts register a beforeunload/unload handler in their iframe as part of their own analytics tracking. Chrome's back/forward cache (bfcache) — which lets a browser instantly restore a page when a user hits back, instead of a full reload — refuses to cache any page containing a frame with an unload handler. This shows up as a hard bf-cache audit failure the moment the video embed loads, and there's no page-level fix for it: it's the video provider's own script doing this, not anything about how the surrounding site was built.

It loads even when "lazy." Native loading="lazy" on the iframe delays the request until the browser judges the element is nearly in view — but on any page long enough, or any audit that scrolls, it still loads before the page is done being evaluated. Lazy-loading defers the cost; it doesn't remove it.

What you can actually do about it

Use a real click-to-play facade — a static thumbnail with a play button that only injects the actual iframe on click. This is the standard, correct pattern, but it's worth verifying it actually works after your specific export or CMS: we found, testing our own converter's implementation, that some site frameworks' own runtime will silently detect the "missing" video component and reconstruct a live iframe anyway, defeating the facade without any visible symptom. Test by loading the page fresh and checking the network tab for player requests before assuming a facade is working.

If a video is genuinely essential above the fold, accept the bf-cache and cookie cost as the price of that specific choice — it's a real cost, but it's Vimeo's or YouTube's, not something a conversion or export process introduces or can fully remove while keeping the video functional.

#framer#video#performance#vimeo#youtube#technical

Convert your Framer site next

Free, takes about a minute, and you can preview the result before deploying.

Convert free →
Up nextThe Best Framer to Next.js Converter Options in 2026, Compared Honestly

Ready to convert your website?

Paste your published Framer URL to generate a production-ready project in minutes.

Why Embedding a YouTube or Vimeo Video Costs More Than You'd Think — Framer → Next.js Optimizer