{"id":29354603,"url":"https://github.com/googlechromelabs/uach-retrofill","last_synced_at":"2025-07-09T03:15:16.559Z","repository":{"id":40350531,"uuid":"318146159","full_name":"GoogleChromeLabs/uach-retrofill","owner":"GoogleChromeLabs","description":"This snippet illustrates how to reconstruct the legacy navigator.userAgent string value from the modern navigator.userAgentData values.","archived":false,"fork":false,"pushed_at":"2024-08-27T14:33:19.000Z","size":126,"stargazers_count":34,"open_issues_count":3,"forks_count":11,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-08-27T16:06:32.581Z","etag":null,"topics":["user-agent"],"latest_commit_sha":null,"homepage":"https://googlechromelabs.github.io/uach-retrofill/demo.html","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GoogleChromeLabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":"docs/code-of-conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-03T09:49:54.000Z","updated_at":"2024-08-27T14:33:21.000Z","dependencies_parsed_at":"2023-01-30T01:00:54.668Z","dependency_job_id":null,"html_url":"https://github.com/GoogleChromeLabs/uach-retrofill","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GoogleChromeLabs/uach-retrofill","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleChromeLabs%2Fuach-retrofill","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleChromeLabs%2Fuach-retrofill/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleChromeLabs%2Fuach-retrofill/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleChromeLabs%2Fuach-retrofill/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GoogleChromeLabs","download_url":"https://codeload.github.com/GoogleChromeLabs/uach-retrofill/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleChromeLabs%2Fuach-retrofill/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264384458,"owners_count":23599619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["user-agent"],"created_at":"2025-07-09T03:15:15.766Z","updated_at":"2025-07-09T03:15:16.554Z","avatar_url":"https://github.com/GoogleChromeLabs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UA-CH retrofill\n\nThis snippet illustrates how to reconstruct the legacy `navigator.userAgent`\nstring value from the modern `navigator.userAgentData` values. The legacy\n`navigator.userAgent` is created only if the current `navigator.userAgent`\nstring matches the reduced User-Agent specification outlined in\n[User-Agent Reduction](https://www.chromium.org/updates/ua-reduction).\n\n## Usage instructions\n\nCopy the contents of `uach-retrofill.js` to the relevant location in your project.\n\nImport the function from the module:\n\n```js\nimport { overrideUserAgentUsingClientHints } from './uach-retrofill.js';\n```\n\nThe `overrideUserAgentUsingClientHints()` function takes an array of hints that will be used to generate the legacy user-agent string format and update the value in `navigator.userAgent`.\n\nThe various hints used, which you can optionally pass in based on your needs are:\n* `architecture` - the CPU architecture\n* `bitness` - the Operating System's underlying CPU architecture bitness (e.g., \"32\" or \"64\")\n* `model` - the model on Android\n* `platformVersion` - the Operating System's version\n* `uaFullVersion` - the browser's full version, in case the significant version (provided by default) is not enough\n* `wow64` - whether or not the browser is running in 32-bit mode on 64-bit Windows\n\nFor example, if you need the full `uaFullVersion`, you would specify:\n\n```js\noverrideUserAgentUsingClientHints([\"uaFullVersion\"]).then(() =\u003e {\n  // navigator.userAgent will be updated with the generated string\n  document.getElementById(\"output\").innerHTML = navigator.userAgent;\n})\n```\n\n## Demo\n\nhttps://googlechromelabs.github.io/uach-retrofill/demo.html\n\n## Contributing\n\nPlease see the [Code of Conduct](docs/code-of-conduct.md) and [Contributing](docs/contributing.md) guides.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglechromelabs%2Fuach-retrofill","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgooglechromelabs%2Fuach-retrofill","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglechromelabs%2Fuach-retrofill/lists"}