From b013d4b55c63b4473867f5026ec86d74a17ebb94 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Mon, 16 Oct 2023 13:03:44 -0400 Subject: [PATCH] lib: add `navigator.userAgent` --- doc/api/globals.md | 15 +++++++++++++++ lib/internal/navigator.js | 10 ++++++++++ test/parallel/test-navigator.js | 2 ++ 3 files changed, 27 insertions(+) diff --git a/doc/api/globals.md b/doc/api/globals.md index 01a6d9327a1669..4efa04e8c1b883 100644 --- a/doc/api/globals.md +++ b/doc/api/globals.md @@ -629,6 +629,21 @@ logical processors available to the current Node.js instance. console.log(`This process is running on ${navigator.hardwareConcurrency}`); ``` +### `navigator.userAgent` + + + +* {string} + +The `navigator.userAgent` read-only property returns user agent +consisting of the runtime name and major version number. + +```js +console.log(`The user-agent is ${navigator.userAgent}`); // Prints "Node.js/21" +``` + ## `PerformanceEntry`