{"id":23814239,"url":"https://github.com/stuartpb/user-agent-is-browser","last_synced_at":"2026-06-17T18:34:21.136Z","repository":{"id":12715019,"uuid":"15387621","full_name":"stuartpb/user-agent-is-browser","owner":"stuartpb","description":"JS function to determine if a string is the User-Agent for a browser","archived":false,"fork":false,"pushed_at":"2014-02-03T16:02:42.000Z","size":140,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-03T12:57:04.021Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"unash/BarrageRenderer","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stuartpb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-23T04:29:28.000Z","updated_at":"2019-07-26T10:30:17.000Z","dependencies_parsed_at":"2022-09-23T09:31:25.512Z","dependency_job_id":null,"html_url":"https://github.com/stuartpb/user-agent-is-browser","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/stuartpb/user-agent-is-browser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stuartpb%2Fuser-agent-is-browser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stuartpb%2Fuser-agent-is-browser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stuartpb%2Fuser-agent-is-browser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stuartpb%2Fuser-agent-is-browser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stuartpb","download_url":"https://codeload.github.com/stuartpb/user-agent-is-browser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stuartpb%2Fuser-agent-is-browser/sbom","scorecard":{"id":856084,"data":{"date":"2025-08-11","repo":{"name":"github.com/stuartpb/user-agent-is-browser","commit":"1dede6a1397f8655e790da2759a1739b088b43fc"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/4 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-23T23:55:21.332Z","repository_id":12715019,"created_at":"2025-08-23T23:55:21.332Z","updated_at":"2025-08-23T23:55:21.332Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34461617,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-17T02:00:05.408Z","response_time":127,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-01-02T03:46:57.962Z","updated_at":"2026-06-17T18:34:21.108Z","avatar_url":"https://github.com/stuartpb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"user-agent-is-a-browser\n=======================\n\nJS function to determine if a string is the User-Agent for a browser (even if it doesn't start with `Mozilla/`!)\n\n## What is this I don't even\n\nThis is a function that determines whether the string you passed in to it matches the whitelist rules of what we expect a browser's UA to look like.\n\n## It only determines if the User-Agent is *a* browser? Not *which* browser it is? What's the point of that?\n\nAh, because, sonny Jim, ***not all HTTP consumers are browsers!*** There's crawlers, robots, libraries, static-retrieval binaries... really, just take a look at [this list of HTTP clients](http://www.useragentstring.com/pages/useragentstring.php) for a wide sampling of many User-Agents there are that aren't, strictly speaking, browsers.\n\nIf you want information on *what* browser is requesting the site via the User-Agent, there are several libraries to do that - just do an NPM search for \"useragent\".\n\n## How does it determine if the User-Agent is a browser?\n\nWell, it starts by checking to see if the string starts with 'Mozilla/'. Ever since Netscape was released and Internet Explorer copied its UA, 99% of browsers that want to signify that they're a browser without causing compatibility issues will start their User-Agent with \"Mozilla/\": this check is enough to catch the latest versions of all the major browsers (IE, Firefox, Chrome, Safari, and even Opera).\n\nHowever, *some* browsers, out of some misguided sense of \"integrity\", or a desire to differentiate themselves and their compatibility, or for whatever reason, chose not to copy the Mozilla prefix (until its move to the Chromium/Blink code base, Opera was probably the highest-profile browser to do this and subsequently suffer for it). Going forward, anybody who's serious about making an HTML5-world-ready browser will have to start their UA with \"Mozilla/5.0\", but for the long-tail of esoteric experimental browsers (such as Lynx and w3m, which aim to making web browsing in terminals), this function uses a white list based on http://www.useragentstring.com/pages/Browserlist/ to recognize these agents as browsers as well.\n\n## Does it exclude User-Agents that impersonate browsers, like crawlers?\n\nNo. If a crawler wants to impersonate a browser by prefixing *its* User-Agent with \"Mozilla/\", this function will let it.\n\n## But *why?*\n\n[meta.sh](http://meta.sh) uses this for its base paths, to determine whether to serve a requestor the HTML page for a script (for browsers), or the plain text of the script (for curl/wget/etc). The world of looking up shell scripts is probably one that is most likely to encounter esoteric browser agents, so a simple \"Mozilla/\" check isn't good enough.\n\n## Is there any browser on that list that ISN'T included in the tests?\n\nNo... well, except for [Enigma Browser](http://ejohn.org/blog/attack-of-the-enigma-browser/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstuartpb%2Fuser-agent-is-browser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstuartpb%2Fuser-agent-is-browser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstuartpb%2Fuser-agent-is-browser/lists"}