Skip to content
ClickJack Test

← Refused to connect

www.youtube.com refused to connect

Why YouTube will not load in a frame, and what to do. Headers checked 2026-11-30.

You put a YouTube watch link (youtube.com/watch?v=... or youtu.be/...) in an iframe. YouTube only lets its own pages frame those URLs. Use the embed URL instead: https://www.youtube.com/embed/VIDEO_ID.

What the site sends

Framing header
X-Frame-Options: SAMEORIGIN
Checked URL
https://www.youtube.com/watch?v=VIDEO_ID
Checked on
2026-11-30

Test it live →

Why it happens

YouTube watch pages send X-Frame-Options: SAMEORIGIN. That header tells the browser to show the page in a frame only when the page around it is also on youtube.com. On your site the browser blocks the response, and Chrome shows "www.youtube.com refused to connect."

YouTube serves a separate player for other sites at /embed/VIDEO_ID. That URL sends no X-Frame-Options header, so it loads anywhere.

Fix it if you are embedding YouTube

Change the URL to the embed form

Take the video ID (the part after v=) and put it after /embed/. On YouTube you can also click Share, then Embed, and copy the code.

<iframe width="560" height="315"
  src="https://www.youtube.com/embed/VIDEO_ID"
  title="YouTube video player"
  allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
  referrerpolicy="strict-origin-when-cross-origin"
  allowfullscreen></iframe>

Convert other YouTube link types

A start time moves from t=90 to start=90. A playlist uses listType=playlist. For privacy-enhanced mode, swap the host for www.youtube-nocookie.com.

youtube.com/watch?v=ID        ->  youtube.com/embed/ID
youtu.be/ID                   ->  youtube.com/embed/ID
youtube.com/watch?v=ID&t=90   ->  youtube.com/embed/ID?start=90
youtube.com/playlist?list=PL  ->  youtube.com/embed?listType=playlist&list=PL

In WordPress, paste the plain link

WordPress and other editors with oEmbed support turn a normal YouTube link into a working player when the link sits on its own line or in an embed block. The error shows up when a watch link is typed into a raw iframe, a lightbox, or a pop-up plugin. Give those the /embed/ URL.

If you only see the error

If a site you are visiting shows this where a video should be, the site used the wrong link. Nothing on your computer is broken. Open the video on youtube.com instead, and tell the site owner if you can.

If YouTube itself will not open in a normal tab, that is a different problem: a network filter, a VPN, or an extension is blocking it. Try another network, or a private window with extensions off.

FAQ

Can I make a youtube.com/watch link work in an iframe?

No. The header comes from YouTube, and nothing in your HTML can switch it off. The embed URL is the supported way.

I use /embed/ and the player says the video is unavailable. Why?

That is a different block. The uploader can turn off "Allow embedding" for a video. The frame loads, but the player will not play it there. Link to the video instead.

The player shows "Error 153". What is that?

The request for the player had no HTTP Referer, which YouTube requires to identify the site that embeds it. The usual cause is a Referrer-Policy that removes the Referer, such as no-referrer on the page or referrerpolicy="no-referrer" on the iframe. YouTube recommends strict-origin-when-cross-origin, which is already the default in many browsers.

Check your headers

See whether a site sends X-Frame-Options or CSP frame-ancestors, and what browsers will do with them.