Skip to main content

How to Resolve "Permissions-Policy header: Unrecognized feature: 'interest-cohort'" Warning in JavaScript

When you open the Chrome DevTools, you might see a warning that says Error with Permissions-Policy header: Unrecognized feature: 'interest-cohort'. This message is informational, generally harmless, and can usually be ignored. It is not an error in your own code.

This guide will explain what this warning means, why it appears, and the simple steps you can take to either resolve it or safely ignore it.

What is the interest-cohort Warning? (FLoC)

This warning is related to a now-discontinued Google technology called FLoC (Federated Learning of Cohorts). FLoC was an experimental alternative to third-party cookies for interest-based advertising. As a privacy measure, many websites and hosting platforms (like GitHub Pages) began automatically sending an HTTP header to opt out of being included in FLoC trials.

That header looks like this: Permissions-Policy: interest-cohort=()

The warning appears because:

  1. The FLoC experiment has been discontinued by Google and replaced by the Topics API.
  2. The interest-cohort feature is no longer recognized by modern versions of Chrome.
  3. The browser is simply informing you that it received a header for a feature it doesn't understand.

This is not a critical error and does not affect the functionality of your site.

For most developers and users, the best and simplest solution is to safely ignore this warning. It is informational and does not indicate a problem with your application. It is generated either by the server you are visiting or the hosting platform you are using. Since the feature is obsolete, the warning has no practical consequence.

Solution 2: Explicitly Set the Permissions-Policy Header

If the warning originates from your own server and you have control over the headers, you can simply remove the interest-cohort=() directive.

However, if you cannot control the server headers but can edit the HTML, you can add a <meta> tag to your index.html file to make your site's policy explicit. While this may not remove the warning (as the HTTP header is still being sent), it ensures your page's intended policy is clear.

Solution: add the following line to the <head> section of your index.html file.

<head>
<meta http-equiv="Permissions-Policy" content="interest-cohort=()">
<!-- ... other meta tags ... -->
</head>

This opts your document out of FLoC. Again, this is mostly a historical measure, as FLoC is no longer in use.

A Special Case: React Router on GitHub Pages

This warning often appears for developers deploying single-page applications (SPAs) with client-side routing (like React Router) to GitHub Pages. This is because:

  1. GitHub Pages automatically adds the Permissions-Policy: interest-cohort=() header.
  2. Client-side routers like BrowserRouter often have issues on static hosts like GitHub Pages, which can lead to confusing 404 errors that developers might misattribute to the console warning.

The interest-cohort warning is a red herring. The actual problem is that BrowserRouter (which uses the HTML5 history API) is not compatible with GitHub Pages' static server.

To fix React Router on GitHub Pages, you must:

  1. Use HashRouter: Replace BrowserRouter with HashRouter in your application. HashRouter uses the URL hash (#) to manage routes, which works on static hosts.
  2. Set the homepage in package.json: You must set the homepage field to the correct URL for your GitHub Pages site.
    "homepage": "https://YOUR_USERNAME.github.io/YOUR_REPOSITORY_NAME",

Following these steps will resolve the routing issues, even though the unrelated interest-cohort warning may still appear in the console.

Conclusion

The Unrecognized feature: 'interest-cohort' warning is a harmless artifact from a discontinued web experiment.

  • For most users and developers, the best course of action is to simply ignore it.
  • If you are deploying a React app to GitHub Pages and experiencing issues, focus on switching to HashRouter and correctly setting your homepage, as the warning is not the cause of your problem.