Gathering detailed insights and metrics for @egjs/agent
Gathering detailed insights and metrics for @egjs/agent
Gathering detailed insights and metrics for @egjs/agent
Gathering detailed insights and metrics for @egjs/agent
Extracts browser and operating system information from the user agent string or user agent object(userAgentData).
npm install @egjs/agent
2.4.4 Release (2024-08-23)
Published on 23 Aug 2024
2.4.3 Release (2022-08-12)
Published on 12 Aug 2022
2.4.2 Release (2022-05-04)
Published on 04 May 2022
2.4.0 Release (2022-04-18)
Published on 18 Apr 2022
2.3.1 Release (2022-03-25)
Published on 25 Mar 2022
2.3.0 Release (2021-02-25)
Published on 26 Feb 2021
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
112 Stars
114 Commits
18 Forks
17 Watching
13 Branches
15 Contributors
Updated on 11 Nov 2024
TypeScript (92.93%)
JavaScript (5.14%)
HTML (1.93%)
Cumulative downloads
Total Downloads
Last day
-13.9%
19,518
Compared to previous day
Last week
1.1%
116,294
Compared to previous week
Last month
2.2%
484,413
Compared to previous month
Last year
45.1%
4,624,241
Compared to previous year
Extracts browser and operating system information from the user agent string or user agent object(userAgentData).
Download dist files from repo directly or install it via npm.
The following command shows how to install egjs-agent using npm.
1$ npm install @egjs/agent
You can download the files for development
Chrome was planned to freeze userAgent to improve user privacy, and it is being applied as an experimental feature in 84+.
Not only Chrome, but other browsers will come someday.
It is still an experimental feature until Chrome(Chromium) 86.
If you want to test, enable the flag below.
chrome://flags/#enable-experimental-web-platform-features chrome://flags/#freeze-user-agent
This reduced format will be available for testing via chrome://flags/#reduce-user-agent in Chrome 93. chrome://flags/#reduce-user-agent
Phase 4: Chrome 101 Ship reduced Chrome MINOR.BUILD.PATCH version numbers (“0.0.0”). Once rolled-out, the reduced UA string would apply to all page loads on desktop and mobile OSes that do not opt into the reverse Origin Trial.
Phase 5: Chrome 107 Begin roll-out of reduced Desktop UA string and related JS APIs (navigator.userAgent, navigator.appVersion, navigator.platform). Once rolled-out, the reduced UA string would apply to all page loads on desktop OSes that do not opt into the reverse Origin Trial.
Phase 6: Chrome 110 Begin roll-out of reduced Android Mobile (and Tablet) UA string and related JS APIs. Once rolled-out, the reduced UA string would apply to all page loads on Android that do not opt into the reverse Origin Trial.
Reduction Completion Phase 7: Chrome 113 reverse Origin Trial ends and all page loads receive the reduced UA string and related JS APIs.
navigator.userAgentData
instead of navigator.userAgent
.
1import getAgent from "@egjs/agent"; 2 3const agent = getAgent(); 4 5// Check iOS 6agent.os.name === "ios" 7agent.os.majorVersion === 9 8// Check Android 9agent.os.name === "android" 10agent.os.majorVersion === 4 11parseFloat(agent.os.version) <= 4.4 12// Check browser name 13agent.browser.name === "safari" 14// Check webkit 15agent.browser.webkit 16// Check chromium 17agent.browser.chromium
1import { getLegacyAgent } from "@egjs/agent"; 2 3const agent = getLegacyAgent(); 4// Check iOS 5agent.os.name === "ios" 6agent.os.majorVersion === 9 7// Check Android 8agent.os.name === "android" 9agent.os.majorVersion === 4 10parseFloat(agent.os.version) <= 4.4 11// Check browser name 12agent.browser.name === "safari" 13// Check webkit 14agent.browser.webkit 15// Check chromium 16agent.browser.chromium
1import getAgent from "@egjs/agent"; 2const agent = getAgent(); 3 4// If the full version is 10.5, it is displayed as 10. 5agent.browser.version 6// "unknown" 7agent.os.name 8// -1 9agent.os.majorVersion
1import { getAccurateAgent } from "@egjs/agent"; 2 3// Use Promise 4getAccurateAgent().then(agent => { 5 // Check OS version 6 agent.os.version 7 8 // Check Browser full verion 9 agent.browser.version 10}); 11 12// Use Callback 13getAccurateAgent(agent => {});
The following are the supported browsers.
Internet Explorer | Chrome | Firefox | Safari | iOS | Android |
---|---|---|---|---|---|
7+ | latest | latest | latest | 3+ | 2.1+ |
Chromium (Chrome, Edge, Whale) | Gecko (Firefox) | Webkit (Safari) |
---|---|---|
84+ (Experimental) | Unknown | Unknown |
For anyone interested to develop egjs-agent, follow the instructions below.
Clone the egjs-agent repository and install the dependency modules.
1# Clone the repository. 2$ git clone https://github.com/naver/egjs-agent.git
npm
is supported.
# Install the dependency modules.
$ npm install
Use npm script to build eg.agent
1# Run rollup 2$ npm start 3 4# Build 5$ npm run build 6 7# Generate jsdoc 8$ npm run jsdoc
Two folders will be created after complete build is completed.
To keep the same code style, we adopted ESLint to maintain our code quality. Setup your editor for check or run below command for linting.
1$ npm run lint
Once you created a branch and done with development, you must perform a test running npm run test
command before you push code to a remote repository.
1$ npm run test
Running a npm run test
command will start Jest.
If you find a bug, please report it to us using the Issues page on GitHub.
egjs-agent is released under the MIT license.
Copyright (c) 2015 NAVER Corp.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
No vulnerabilities found.
No security vulnerabilities found.