Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including universal-user-agent with all npm packages installed. Try it out:

var universalUserAgent = require("universal-user-agent")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

universal-user-agent v5.0.0

Get a user agent string in both browser and node

universal-user-agent

Get a user agent string in both browser and node

@latest Build Status Greenkeeper

const { getUserAgent } = require("universal-user-agent");
// or import { getUserAgent } from "universal-user-agent";

const userAgent = getUserAgent();
// userAgent will look like this
// in browser: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:61.0) Gecko/20100101 Firefox/61.0"
// in node: Node.js/v8.9.4 (macOS High Sierra; x64)

Credits

The Node implementation was originally inspired by default-user-agent.

License

ISC

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free