14

I am currently using a simple iframe in my webpage using bootstrap that is adapted to small screens (=youtube short) and large screens (=normal landscape video):

  <div class="container d-none d-md-block" style="max-width:1000px;height:30%;">

      <iframe width="1000" height="550"
        src="https://www.youtube-nocookie.com/embed/0...?&mute=1&autoplay=1&encrypted-media=1" allow="autoplay; fullscreen;">
    </iframe>

  </div>

  <div class="container .d-block d-md-none" style="width:95%;">

      <iframe width="400" height="500"
        src="https://www.youtube-nocookie.com/embed/G...?&mute=1&autoplay=1&encrypted-media=1" allow="autoplay; fullscreen;">
    </iframe>

  </div>

</div>

I have a warning/error message saying:

Error with Permissions-Policy header: Unrecognized feature: 'ch-ua-form-factor'.

After investigation, it seems to be related to screen size: https://wicg.github.io/ua-client-hints/

But if I remove the classes for screen size like "d-none d-md-block", there is still the same message (might be due to a parent screen size config).

In addition to that, the error also appears if I remove all the iframe options and if I use www.youtube.com instead of www.youtube-nocookie.com.

How can I solve this problem?

Nicolas-Fractal
  • 321
  • 1
  • 1
  • 9
  • Hello, I have the exact same problem with the same usecase (youtube-nocookie for an embed video.) I may add that each time the warning triggers, my video stops and the iframe restart itself, causing the video to be unreadable on a webpage. Also, some network requests to youtube-api are failing but they are not clear. – Denis Lebon Jun 02 '23 at 15:15

3 Answers3

5

I been getting same warning on my page containing an embedded YouTube video and I dig a bit deeper into the situation, just to discover is actually coming from their side, as the element violating the rules is inside of the embed. So I think the suggestion to ignore the warning is the best to follow.

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 03 '23 at 18:25
3

This error refers to a permission policy that is not recognized by the browser. This can happen when the browser is updated and a new policy is now recognized.

To resolve this issue, you can add the permission policy ch-ua-form-factor in your request header to your server. e.g.

res.setHeader('Permissions-Policy', 'ch-ua-form-factor');
Benjamin Loison
  • 3,782
  • 4
  • 16
  • 33
fullerm
  • 406
  • 1
  • 8
  • 23
  • Thanks for your answer. The error still appears, even if I setup the server header with ch-ua-form-factor response.headers["Permissions-Policy"] = 'ch-ua-form-factor=(*)' Do you have another solution? After some investigation using a famous AI, it seems to be related to Chrome and a window.matchMedia function. – Nicolas-Fractal May 26 '23 at 08:16
  • 2
    Some people suggest to ignore it: https://stackoverflow.com/questions/69619035/error-with-permissions-policy-header-unrecognized-feature-interest-cohort – Nicolas-Fractal May 26 '23 at 08:21
3

I receive this same Unrecognized feature: 'ch-ua-form-factor' error as a casual user of YouTube. I've tried with MacOS Ventura 13.3.1 in Chrome 114. I believe this is because Chrome's User-Agent reduction trial is over and Chrome versions 113+ do not permit this Accept-CH request.

I see on this Chrome Developers blog post that Chrome started using Sec-CH-UA-Form-Factor in Chrome 89. Versions 103–112 were part of the deprecation trial, where websites could register to continue to receive the full UA string.

Could it be that YouTube itself needs to migrate to the User Agent Client Hints (UA-CH) specification and send Accept-CH: Sec-CH-UA-Form-Factor rather than trying to get CH-UA-Form-Factor? It's particularly frustrating as a user because the form factor value for desktop computers is an empty string.

See RFC8942 https://datatracker.ietf.org/doc/html/rfc8942) and the Web Platform Incubator Community Group's Draft Report.

The error currently occurs on selected live webcasts, both while they are streaming and after the recording is posted. The latest YouTube video I failed to load on my Mac is here

  • It loads on my Android phone
  • It won't load in Firefox 113 or Safari 16.4 because of Content Security Policy: Couldn’t process unknown directive ‘require-trusted-types-for’ which leads to HTTP 401
  • Logging in or out of YouTube/Google doesn't help