Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

useragent-generator

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

useragent-generator

Generate user-agent strings for popular browsers

  • 1.1.1-amkt-22079-finish.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

User Agent Generator

Travis npm

Easily generate accurate user-agent strings for popular browsers.

Installing

npm install useragent-generator

Usage

const ua = require('useragent-generator')
// ...

Table of Contents

Chrome

Chromium

Firefox

Safari

Internet Explorer

Microsoft Edge

Search Engines

Chrome

ua.chrome(options)

Examples
ua.chrome(60)
ua.chrome('61.0.0')
ua.chrome({ version: '61.0.0', os: 'Windows NT 6.3' })
ParamTypeDefault Value
options.versionstring
options.osstringWindows NT 6.4 (Windows 10)

ua.chrome.androidPhone(options) / ua.chrome.androidTablet(options)

Examples
ua.chrome.androidPhone(60)
ua.chrome.androidPhone('61.0.0')
ua.chrome.androidPhone({ version: '61.0.0', androidVersion: '6.2.1', device: 'Nexus 6' })

ua.chrome.androidTablet(60)
ua.chrome.androidTablet('61.0.0')
ua.chrome.androidTablet({ version: '61.0.0', androidVersion: '6.2.1', device: 'SM-T210' })
ParamTypeDefault Value
options.versionstring
options.androidVersionstring7.0.0 (Nougat)
options.devicestringPixel (Phone) / Pixel C (Tablet)

ua.chrome.iOS(options)

Examples
ua.chrome.iOS(10) // iOS version
ua.chrome.iOS('10.0.1') // iOS version
ua.chrome.iOS({ iOSVersion: '10.0.1', iOSVersion: '62.1.0', device: 'iPad' })
ParamTypeDefault Value
options.iOSVersionstring
options.chromeVersionstring60.0.0.0
options.devicestringiPhone

ua.chrome.androidWebview(options)

Examples
ua.chrome.androidWebview(4) // Android OS version
ua.chrome.androidWebview('4.4') // Android OS version
ua.chrome.androidWebview({ androidVersion: '5.0.0', chromeVersion: '60.1.0', device: 'Nexus 6' })
ParamTypeDefault Value
options.androidVersionstring
options.chromeVersionstring60.0.0.0 (applicable only for Android 4.4 (Kitkat) and above)
options.devicestringPixel

ua.chrome.chromecast(options)

Example
ua.chrome.chromecast(62) 
ua.chrome.chromecast('62.1.0') // Android OS version
ua.chrome.chromecast({ version: '62.1.0' })
ParamTypeDefault Value
options.versionstring

Chromium

ua.chromium(options)

Same as ua.chrome

Firefox

ua.firefox(options)

Examples
ua.firefox(52) 
ua.firefox('52.4') 
ua.firefox({ version: '53.4.1', os: 'Windows NT 6.3' })
ParamTypeDefault Value
options.versionstring
options.osstringWindows NT 6.4 (Windows 10)

ua.firefox.androidPhone(options) / ua.firefox.androidTablet(options)

Examples
ua.firefox.androidPhone(52)
ua.firefox.androidPhone('52.4')
ua.firefox.androidPhone({ version: '52.4.1', androidVersion: '6.2.1', device: 'Nexus 6' })

ua.chrome.androidTablet(60)
ua.chrome.androidTablet('61.0.0')
ua.chrome.androidTablet({ version: '52.4.1', androidVersion: '6.2.1', device: 'SM-T210' })
ParamTypeDefault Value
options.versionstring
options.androidVersionstring7.0.0 (Nougat)
options.devicestringPixel (Phone) / Pixel C (Tablet)

ua.firefox.iOS(options)

Examples
ua.firefox.iOS(10) // iOS version
ua.firefox.iOS('10.0.1') // iOS version
ua.firefox.iOS({ iOSVersion: '10.0.1', device: 'iPad' })
ParamTypeDefault Value
options.iOSVersionstring
options.devicestringiPhone

Safari

ua.safari(options)

Examples
ua.safari(10) 
ua.safari('10.1.0') 
ua.safari({ version: '10.3.1', os: 'Macintosh; Intel Mac OS X 10_11' })
ParamTypeDefault Value
options.versionstring
options.osstringMacintosh; Intel Mac OS X 10_11 (Mac OS X El Capitan)

ua.safari.iOS(options)

Examples
ua.safari.iOS(10) // iOS version
ua.safari.iOS('10.0.1') // iOS version
ua.safari.iOS({ iOSVersion: '10.0.1', safariVersion: '10.3.0', device: 'iPad' })
ParamTypeDefault Value
options.iOSVersionstring
options.safariVersionstring(equal to iOSversion)
options.devicestringiPhone

ua.safari.iOSWebview(options)

Examples
ua.safari.iOSWebview(10) // iOS version
ua.safari.iOSWebview('10.0.1') // iOS version
ua.safari.iOSWebview({ iOSVersion: '10.0.1', safariVersion: '10.3.0', device: 'iPad' })
ParamTypeDefault Value
options.iOSVersionstring
options.safariVersionstring(equal to iOSversion)
options.devicestringiPhone

Internet Explorer

ua.ie(options)

Examples
ua.ie(9) 
ua.ie('9.0.1') 
ua.ie({ version: '9.0.1', os: 'Windows NT 6.3' })
ParamTypeDefault Value
options.versionstring
options.osstringWindows NT 6.4 (Windows 10)

ua.ie.windowsPhone(options)

Examples
ua.ie(9) 
ua.ie('9.0.1') 
ua.ie({ version: '9.0.1', os: 'Lumia 625' })
ParamTypeDefault Value
options.versionstring
options.devicestringLumia 630

Microsoft Edge

ua.edge(options)

Examples
ua.edge(12) 
ua.edge('12.0.1') 
ua.edge({ version: '12.0.1', chromeVersion: '62.0.1', os: 'Windows NT 6.3' })
ParamTypeDefault Value
options.versionstring
options.chromeVersionstring52.0.0.0
options.osstringWindows NT 6.4 (Windows 10)

Search Engines

Examples
ua.googleBot()
ua.bingBot()
ua.yahooBot()

ua.googleBot('2.0')
ua.bingBot('2.1')

ua.googleBot(options) — GoogleBot

ParamTypeDefault Value
options.versionstring (optional)'2.1'

ua.bingBot(options) — BingBot

ParamTypeDefault Value
options.versionstring (optional)'2.0'

ua.yahooBot() — YahooBot

FAQs

Package last updated on 13 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc