-
Notifications
You must be signed in to change notification settings - Fork 489
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Added support Sec-CH-UA-Form-Factors header for ClientHints #7807
Conversation
maybe we should add examples to the documentation for client-hints? For example, through JS, we can get them like this: function getHints() {
return new Promise((resolve, reject) => {
if (!navigator.userAgentData) {
return resolve({})
}
let requestHints = [
'brands',
'mobile',
'platform',
'platformVersion',
'architecture',
'bitness',
'wow64',
'model',
'formFactors',
'uaFullVersion',
'fullVersionList'];
navigator.userAgentData.getHighEntropyValues(requestHints).then((result) => {
resolve(JSON.parse(JSON.stringify(result)))
}).catch(() => {
resolve({});
});
})
} getHints().then(data =>console.log(data)) |
@sanchezzzhak Based on the definition formFactors is a |
@sgiehl yes there should be an array. I think the form factor based on the user agent string, since there is no prefix (Table|Mobile|VR|TV|XR) is set by default to Desktop |
… ClientHints FormFactors header
Co-authored-by: Liviu-Mihail Concioiu <liviu.concioiu@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me now.
Specs: https://wicg.github.io/ua-client-hints/#sec-ch-ua-form-factors
form factor support for chrome 124+ https://chromestatus.com/feature/5162545698045952