UNPKG

@eternaljs/user-agent

Version:

A user agent request is a string of text that identifies the client software requesting online content.

51 lines (35 loc) 1.06 kB
# User Agent A user agent request is a string of text that identifies the client software requesting online content. It's contained in the HTTP headers and is sent to the web server when connecting to a website. ## Installing Using npm: ```bash $ npm install @eternaljs/user-agent ``` Using yarn: ```bash $ yarn add @eternaljs/user-agent ``` ## Imports These examples assume you're in node, or something similar: ```javascript // JavaScript const { userAgent } = require("@eternaljs/user-agent"); // TypeScript import { userAgent } from "@eternaljs/user-agent"; ``` ## Usage Example ``` const agent = userAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36') ``` ``` { browser: 'Chrome', version: '130.0.0.0', os: 'Windows 10.0', platform: 'Microsoft Windows', source: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36', type: 'web' } ``` ## License MIT