Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

std/http/mod.ts>UserAgent

The Deno Standard Library
Go to Latest
class UserAgent
import { UserAgent } from "https://deno.land/std@0.223.0/http/mod.ts";

A representation of user agent string, which can be used to determine environmental information represented by the string. All properties are determined lazily.

Constructors

new
UserAgent(ua: string | null)

Constructs a new instance.

Properties

readonly
browser: Browser

The name and version of the browser extracted from the user agent string.

readonly
cpu: Cpu

The architecture of the CPU extracted from the user agent string.

readonly
device: Device

The model, type, and vendor of a device if present in a user agent string.

readonly
engine: Engine

The name and version of the browser engine in a user agent string.

readonly
os: Os

The name and version of the operating system in a user agent string.

readonly
ua: string

A read only version of the user agent string related to the instance.

Methods

toJSON(): { browser: Browser; cpu: Cpu; device: Device; engine: Engine; os: Os; ua: string; }

Converts the current instance to a JSON representation.

toString(): string

Converts the current instance to a string.

[Symbol.for("Deno.customInspect")](inspect: (value: unknown) => string): string

Custom output for Deno.inspect.

[Symbol.for("nodejs.util.inspect.custom")](
depth: number,
options: any,
inspect: (value: unknown, options?: unknown) => string,
): string

Custom output for Node's util.inspect.