WICG/ua-client-hints

Permissions-Policy not work

minajiale opened this issue · 1 comments

`app.get('/', (req, res) => {
let displayHeader = '[not set]';

if (req.query.noheader != 'noheader') {
let rawCH = [];

if (typeof req.query.uach === 'string') {
  rawCH = [req.query.uach];
} else if (Array.isArray(req.query.uach)) {
  rawCH = req.query.uach;
}

const acceptCH = [];

rawCH.forEach((uach) => {
  if (_HINTS.indexOf(uach) >= 0) {
    acceptCH.push(uach);
  }
});

let mergedTokens = acceptCH.join(', ');

// Older versions of the spec did not include the 'Sec-CH-' prefix
// during the transition, we should send both formats
// acceptCH.forEach(hint => {
//   mergedTokens += ', ' + hint.substring(7);
// });

res.set('Feature-Policy', "Sec-CH-UA-Full-Version=(self 'https://cdn.glitch.com/')");

displayHeader = 'Accept-CH: ' + mergedTokens;

}

res.render('meta', { displayHeader: displayHeader });
});`

(this was closed, but note that Feature-Policy was renamed to Permissions-Policy)