Search code examples
htmlmeta-tagsclient-hintshttp-permissions-policy

Declaring Feature-Policy (Permissions-Policy) headers in HTML meta tag


Is it possible to add feature policy headers by doing meta tag implementation? Apparently it didn't work for me with the following specific feature.

<meta http-equiv="Feature-Policy" content="ch-viewport-width *">

I'm trying to implement Client Hints for the server-side adaptive images that are coming from a different origin (i.e. on a website.com for images coming from cdn.com or at least cdn.website.com).

By default, the needed Client Hints headers are being sent only with the same origin image requests. I looked up for the specific value in the specification which I need which is possible to change in the Feature Policy (ch-viewport-width). Although if I used the method above with the meta tag in the HTML, it still doesn't change anything and by running a JavaScript line document.featurePolicy.getAllowlistForFeature("ch-viewport-width") I still get the only default value (origin).


Solution

  • Based on the extensive tests that I did across the browsers, it isn't possible so far in any of the major browsers.