# random-ua

> Randomly generates User-Agent strings based on actual usage statistics from Wikimedia.

Latest version **0.0.6** (published 2014-08-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install random-ua
pnpm add random-ua
yarn add random-ua
bun add random-ua
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2014-08-31 |
| First published | 2013-02-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | * |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 35 |
| Author | Jeffrey Mealo |
| Maintainers | jmealo |
| Keywords | user, agent, browser, user-agent, http, random |

## Links

- npm: https://www.npmjs.com/package/random-ua
- Repository: https://github.com/jmealo/random-ua.js
- Issues: https://github.com/jmealo/random-ua.js/issues
- npm.io page: https://npm.io/package/random-ua

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.0.6 (latest) — 2014-08-31
- 0.0.4 — 2013-02-22
- 0.0.3 — 2013-02-06
- 0.0.2 — 2013-02-06
- 0.0.1 — 2013-02-06

## README

random-ua.js - A random User-Agent Generator
============================================
Randomly generates User-Agent strings based on actual browser market share and usage statistics.

Caveats
-------
The version numbers generated are sane, however, revisions are totally random and unlikely to exist in the wild.

I decided not to include language selection found in the PHP version and instead include all the languages in the
[ISO639-2](http://www.loc.gov/standards/iso639-2/) standard because it's atypical for sites to determine client locale based on the user-agent.

Usage
-----
```js
var random_ua = require('random-ua');

console.log(random_ua.generate());
//Easy like Sunday morning

//You can easily use random_ua to generate a random User-Agent for an HTTP request:

var http = require('http');

http.get({
        host:'whatsmyuseragent.com',
        path:'/',
        headers:{
            'User-Agent':random_ua.generate()
        }
    },
    function (res) {
        if (res.statusCode === 200) {
            var body = [];
            res.setEncoding('utf8');
            res.on('data', function (chunk) {
                body.push(chunk);
            });
            res.on('end', function () {
                body = body.join('');
                console.log(body);
            });
        } else {
            console.log('Error retrieving page: ' + res.statusCode);
        }
    }
);
```

Options
-------
Please send your suggestions for improvements or updates.

Based Upon
----------
This script is roughly based upon Luka Pusic's PHP script: http://360percents.com/posts/php-random-user-agent-generator/

A refactored version in PHP is available on GitHub at:
https://raw.github.com/mwhite/random-uagent/

License
-------
MIT License

---
_Source: https://npm.io/package/random-ua · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
