Skip to content

Latest commit

 

History

36 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ua-hints

Last version Coverage Status NPM Status

It generates Sec-CH-UA-* headers for the provided 'user-agent'.

Install

$ npm install ua-hints --save

Usage

Giving an user agent as input, such as:

Mozilla/5.0 (Windows NT 10.0; Win64; x64; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.6099.109 Safari/537.36

This library returns The User-Agent Client Hints detected:

const uaHints = require('ua-hints')

uaHint('Mozilla/5.0 (Windows NT 10.0; Win64; x64; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.6099.109 Safari/537.36')
// {
//   'sec-ch-ua': '"Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120"',
//   'sec-ch-ua-mobile': '?0',
//   'sec-ch-ua-platform': '"Windows"',
//   'sec-ch-ua-platform-version': '"10"',
//   'sec-ch-ua-arch': '"x86"',
//   'sec-ch-ua-bitness': '"64"',
//   'sec-ch-ua-full-version': '"120.0.6099.109"',
//   'sec-ch-ua-full-version-list': '"Not_A Brand";v="8.0.0.0", "Chromium";v="120.0.6099.109", "Google Chrome";v="120.0.6099.109"',
//   'sec-ch-ua-wow64': '?1',
//   'sec-ch-ua-form-factors': '["Desktop"]'
// }

The library implements Chromium's GREASEing strategy (¹)(²) includes intentionally incorrect data to prevent ossification attacks.

License

ua-hints © Kiko Beats, released under the MIT License.
Authored and maintained by Kiko Beats with help from contributors.

kikobeats.com · GitHub Kiko Beats · Twitter @kikobeats

About

Generate Client Hints (Sec-CH-UA) HTTP headers that match a given browser User-Agent string.

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages