aki-info-detect 2.0.1 โ 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +192 -0
- package/dist/aki-info-detect.js +1 -1
- package/dist/aki-info-detect.umd.cjs +1 -1
- package/dist/index.html +305 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,6 +6,198 @@ A lightweight JavaScript library for detecting device, browser, hardware, and ne
|
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
7
|
[](https://bundlephobia.com/package/aki-info-detect)
|
|
8
8
|
|
|
9
|
+
## Introduction
|
|
10
|
+
|
|
11
|
+
**aki-info-detect** is a modern, lightweight JavaScript library designed to provide comprehensive device, browser, and system information detection for web applications. Built with performance and developer experience in mind, it leverages modern browser APIs including the Client Hints API for accurate hardware detection while maintaining a small footprint (~3.8 kB gzipped).
|
|
12
|
+
|
|
13
|
+
Whether you need to customize user experiences based on device capabilities, gather analytics data, or implement platform-specific features, aki-info-detect provides a unified, easy-to-use API that works seamlessly across all modern browsers.
|
|
14
|
+
|
|
15
|
+
### Why aki-info-detect?
|
|
16
|
+
|
|
17
|
+
- **๐ฏ Comprehensive Detection**: Get detailed information about browser, OS, CPU, GPU, RAM, network, battery, and more from a single library
|
|
18
|
+
- **โก Performance-First**: Minimal bundle size with tree-shakeable exportsโimport only what you need
|
|
19
|
+
- **๐ฎ Future-Proof**: Built on modern Web APIs with graceful fallbacks for older browsers
|
|
20
|
+
- **๐ช Apple Silicon Ready**: Advanced detection for Apple M-series chips (M1, M2, M3, M4, and beyond)
|
|
21
|
+
- **๐ Privacy-Conscious**: Implements caching for network requests to minimize external API calls
|
|
22
|
+
- **๐ฆ Zero Dependencies**: No external runtime dependenciesโjust pure, optimized JavaScript
|
|
23
|
+
- **๐จ Developer-Friendly**: TypeScript declarations included, intuitive API design, comprehensive documentation
|
|
24
|
+
|
|
25
|
+
## Use Cases
|
|
26
|
+
|
|
27
|
+
### 1. **Adaptive User Interfaces**
|
|
28
|
+
Dynamically adjust your UI based on device capabilities and screen properties:
|
|
29
|
+
```javascript
|
|
30
|
+
const info = await akiInfoDetect();
|
|
31
|
+
if (info.isMobile) {
|
|
32
|
+
// Load mobile-optimized components
|
|
33
|
+
loadMobileUI();
|
|
34
|
+
} else if (info.RAM < 4) {
|
|
35
|
+
// Use lightweight version for low-memory devices
|
|
36
|
+
enableLowMemoryMode();
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 2. **Analytics & User Insights**
|
|
41
|
+
Gather detailed technical data to understand your user base:
|
|
42
|
+
```javascript
|
|
43
|
+
const info = await akiInfoDetect();
|
|
44
|
+
analytics.track('page_view', {
|
|
45
|
+
browser: info.browser,
|
|
46
|
+
os: info.os.string,
|
|
47
|
+
device: info.isMobile ? 'mobile' : 'desktop',
|
|
48
|
+
gpu: info.GPU,
|
|
49
|
+
country: await info.getCountry()
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 3. **Feature Detection & Progressive Enhancement**
|
|
54
|
+
Enable or disable features based on browser capabilities:
|
|
55
|
+
```javascript
|
|
56
|
+
const info = await akiInfoDetect();
|
|
57
|
+
if (info.browser.includes('Chrome') && parseInt(info.browser.split(' ')[1]) >= 90) {
|
|
58
|
+
// Enable features requiring Chrome 90+
|
|
59
|
+
enableAdvancedFeatures();
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 4. **Platform-Specific Optimization**
|
|
64
|
+
Optimize content delivery based on hardware capabilities:
|
|
65
|
+
```javascript
|
|
66
|
+
const info = await akiInfoDetect();
|
|
67
|
+
if (info.CPU === 'Apple Silicon') {
|
|
68
|
+
// Load optimized assets for Apple Silicon
|
|
69
|
+
loadWebPImages();
|
|
70
|
+
} else if (info.GPU.includes('NVIDIA')) {
|
|
71
|
+
// Enable GPU-accelerated features
|
|
72
|
+
enableHardwareAcceleration();
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 5. **Targeted User Support**
|
|
77
|
+
Provide context-aware help and troubleshooting:
|
|
78
|
+
```javascript
|
|
79
|
+
const info = await akiInfoDetect();
|
|
80
|
+
if (info.browser.includes('Safari') && info.os.name === 'ios') {
|
|
81
|
+
showMessage('For best experience on iOS Safari, please enable...');
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 6. **Network-Aware Loading**
|
|
86
|
+
Adapt content loading strategies based on connection quality:
|
|
87
|
+
```javascript
|
|
88
|
+
const info = await akiInfoDetect();
|
|
89
|
+
const conn = info.getConnection();
|
|
90
|
+
if (conn.type === '4g' && conn.downlink > 5) {
|
|
91
|
+
// High-speed connection: load high-quality assets
|
|
92
|
+
loadHDContent();
|
|
93
|
+
} else {
|
|
94
|
+
// Optimize for slower connections
|
|
95
|
+
loadCompressedContent();
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Comparison with Similar Libraries
|
|
100
|
+
|
|
101
|
+
| Feature | aki-info-detect | Platform.js | UA-Parser.js | Detect.js |
|
|
102
|
+
|---------|----------------|-------------|--------------|-----------|
|
|
103
|
+
| **Bundle Size (gzipped)** | ~3.8 kB | ~2.5 kB | ~9 kB | Varies |
|
|
104
|
+
| **Client Hints API** | โ
Full Support | โ No | โ No | โ No |
|
|
105
|
+
| **GPU Detection** | โ
Yes | โ No | โ No | โ No |
|
|
106
|
+
| **Apple Silicon Detection** | โ
Yes (M1-MX) | โ No | โ No | โ No |
|
|
107
|
+
| **Network Info (IP/ISP)** | โ
Yes (cached) | โ No | โ No | โ No |
|
|
108
|
+
| **Battery Status** | โ
Yes | โ No | โ No | โ No |
|
|
109
|
+
| **Geolocation** | โ
Yes | โ No | โ No | โ No |
|
|
110
|
+
| **Tree-shakeable** | โ
Yes | โ ๏ธ Partial | โ ๏ธ Partial | โ ๏ธ Partial |
|
|
111
|
+
| **TypeScript** | โ
Full declarations | โ ๏ธ Community types | โ
Yes | โ No |
|
|
112
|
+
| **Active Maintenance** | โ
Yes | โ ๏ธ Sporadic | โ
Yes | โ Archived |
|
|
113
|
+
| **Modern Build System** | โ
Vite | โ Legacy | โ
Webpack | โ Legacy |
|
|
114
|
+
|
|
115
|
+
### Key Differentiators
|
|
116
|
+
|
|
117
|
+
**vs. Platform.js**
|
|
118
|
+
- aki-info-detect is a modern evolution with Client Hints API support for more accurate detection
|
|
119
|
+
- Adds hardware detection (GPU, RAM) and network capabilities not available in Platform.js
|
|
120
|
+
- Built with modern tooling (Vite) for better tree-shaking and optimization
|
|
121
|
+
|
|
122
|
+
**vs. UA-Parser.js**
|
|
123
|
+
- Lighter bundle size while providing more comprehensive information
|
|
124
|
+
- Includes hardware and network detection beyond just user agent parsing
|
|
125
|
+
- Native async/await support with modern API design
|
|
126
|
+
|
|
127
|
+
**vs. Detect.js**
|
|
128
|
+
- Active maintenance (Detect.js is archived)
|
|
129
|
+
- Smaller, more focused API surface with better performance
|
|
130
|
+
- Modern Web API integration for enhanced detection capabilities
|
|
131
|
+
|
|
132
|
+
## Frequently Asked Questions (FAQ)
|
|
133
|
+
|
|
134
|
+
### General Questions
|
|
135
|
+
|
|
136
|
+
**Q: What browsers does aki-info-detect support?**
|
|
137
|
+
A: All modern browsers with ES2020+ support: Chrome/Edge 89+, Firefox 88+, Safari 14+, Opera 76+. Client Hints features work best in Chromium-based browsers.
|
|
138
|
+
|
|
139
|
+
**Q: Does it work in Node.js or server-side environments?**
|
|
140
|
+
A: No, aki-info-detect is specifically designed for browser environments. It relies on browser APIs like `navigator`, `screen`, and Web APIs that are not available in Node.js.
|
|
141
|
+
|
|
142
|
+
**Q: How accurate is the detection?**
|
|
143
|
+
A: Very accurate for modern browsers that support Client Hints API. For browsers without Client Hints, it falls back to user agent parsing which is still reliable but less detailed. GPU and CPU detection is most accurate in Chromium-based browsers.
|
|
144
|
+
|
|
145
|
+
**Q: Is user agent string spoofing a concern?**
|
|
146
|
+
A: While user agents can be spoofed, Client Hints API provides more reliable detection. For critical functionality, always combine with feature detection rather than relying solely on browser/platform detection.
|
|
147
|
+
|
|
148
|
+
### Privacy & Security
|
|
149
|
+
|
|
150
|
+
**Q: Does aki-info-detect collect or transmit user data?**
|
|
151
|
+
A: No. The library only detects information locally in the browser. The optional network info feature (`getNetworkInfo()`) makes a request to a public IP API, but this is only triggered when you explicitly call that method.
|
|
152
|
+
|
|
153
|
+
**Q: What about user privacy?**
|
|
154
|
+
A: aki-info-detect is privacy-conscious. Network requests are cached for 1 hour to minimize external API calls, and all detection happens client-side. No data is sent to our servers.
|
|
155
|
+
|
|
156
|
+
**Q: Is it GDPR compliant?**
|
|
157
|
+
A: Detection of browser/device information is generally considered functional data necessary for website operation. However, always review your local regulations and privacy policies, especially when using geolocation or storing detected data.
|
|
158
|
+
|
|
159
|
+
### Technical Questions
|
|
160
|
+
|
|
161
|
+
**Q: Why do I need to configure server headers?**
|
|
162
|
+
A: The Client Hints API requires the server to explicitly request detailed information via `Accept-CH` headers. Without these headers, browsers will only provide basic user agent data. This is a browser security feature designed to enhance user privacy.
|
|
163
|
+
|
|
164
|
+
**Q: Can I use it with React, Vue, or other frameworks?**
|
|
165
|
+
A: Absolutely! aki-info-detect is framework-agnostic. See the React Hook and Vue Composable examples in the documentation for integration patterns.
|
|
166
|
+
|
|
167
|
+
**Q: How do I reduce bundle size further?**
|
|
168
|
+
A: Use tree-shakeable imports to include only the functions you need:
|
|
169
|
+
```javascript
|
|
170
|
+
import { detectBrowser, detectOS } from 'aki-info-detect';
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**Q: Does it support TypeScript?**
|
|
174
|
+
A: Yes, full TypeScript declarations are included in the package.
|
|
175
|
+
|
|
176
|
+
**Q: How often is the network information cached?**
|
|
177
|
+
A: Network info (IP, ISP, country) is cached for 1 hour by default. You can force a refresh by passing `true` to `getNetworkInfo(true)`.
|
|
178
|
+
|
|
179
|
+
### Troubleshooting
|
|
180
|
+
|
|
181
|
+
**Q: Why am I getting generic hardware info?**
|
|
182
|
+
A: Make sure your server is configured to send the required `Accept-CH` headers. Without these headers, detailed Client Hints data won't be available.
|
|
183
|
+
|
|
184
|
+
**Q: Why is GPU detection returning "Unknown"?**
|
|
185
|
+
A: GPU detection works best in Chromium browsers with Client Hints. Safari and Firefox have limited support. Also, some browsers may restrict this information for privacy reasons.
|
|
186
|
+
|
|
187
|
+
**Q: The library says "Unknown" for many fields. What's wrong?**
|
|
188
|
+
A: Check browser console for errors, ensure you're using a supported browser version, and verify that your server is sending proper Client Hints headers (see Server Configuration section).
|
|
189
|
+
|
|
190
|
+
### Usage & Development
|
|
191
|
+
|
|
192
|
+
**Q: Can I contribute to the project?**
|
|
193
|
+
A: Yes! Contributions are welcome. Please check the GitHub repository for contribution guidelines.
|
|
194
|
+
|
|
195
|
+
**Q: How do I report a bug or request a feature?**
|
|
196
|
+
A: Open an issue on the [GitHub repository](https://github.com/lacvietanh/akiInfoDetect.js/issues) with details about the bug or feature request.
|
|
197
|
+
|
|
198
|
+
**Q: Is there a demo I can try?**
|
|
199
|
+
A: Yes! Visit the [live demo](https://akiinfodetect-js.pages.dev/) to see the library in action.
|
|
200
|
+
|
|
9
201
|
## Features
|
|
10
202
|
|
|
11
203
|
- ๐ **Browser Detection** โ Name, version, rendering engine
|
package/dist/aki-info-detect.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).akiInfoDetect={})}(this,function(e){"use strict";
|
|
2
2
|
/*!
|
|
3
|
-
* aki-info-detect v2.0.
|
|
3
|
+
* aki-info-detect v2.0.2
|
|
4
4
|
* (c) 2025 lacvietanh
|
|
5
5
|
* Released under the MIT License
|
|
6
6
|
* https://akiinfodetect-js.pages.dev/
|
package/dist/index.html
CHANGED
|
@@ -543,13 +543,316 @@
|
|
|
543
543
|
|
|
544
544
|
<!-- Tabs -->
|
|
545
545
|
<div class="tabs">
|
|
546
|
-
<button class="tab active" data-tab="
|
|
546
|
+
<button class="tab active" data-tab="intro">Intro</button>
|
|
547
|
+
<button class="tab" data-tab="demo">Demo</button>
|
|
547
548
|
<button class="tab" data-tab="docs">Documentation</button>
|
|
548
549
|
<button class="tab" data-tab="api">API Reference</button>
|
|
549
550
|
</div>
|
|
550
551
|
|
|
552
|
+
<!-- Intro Tab -->
|
|
553
|
+
<div class="tab-content active" id="intro">
|
|
554
|
+
<div class="docs-content">
|
|
555
|
+
<h2>Welcome to aki-info-detect</h2>
|
|
556
|
+
<p>
|
|
557
|
+
<strong>aki-info-detect</strong> is a modern, lightweight JavaScript library that provides comprehensive device, browser, and system information detection for web applications. Built with performance and developer experience in mind, it leverages modern browser APIs including the Client Hints API for accurate hardware detection while maintaining a minimal footprint (~3.8 kB gzipped).
|
|
558
|
+
</p>
|
|
559
|
+
<p>
|
|
560
|
+
Whether you need to customize user experiences based on device capabilities, gather analytics data, or implement platform-specific features, aki-info-detect provides a unified, easy-to-use API that works seamlessly across all modern browsers.
|
|
561
|
+
</p>
|
|
562
|
+
|
|
563
|
+
<div class="note-box">
|
|
564
|
+
<strong>โก Quick Start:</strong> Install with <code>npm install aki-info-detect</code> and start detecting in seconds!
|
|
565
|
+
</div>
|
|
566
|
+
|
|
567
|
+
<h2>Key Benefits</h2>
|
|
568
|
+
<div class="feature-grid">
|
|
569
|
+
<div class="feature-item">
|
|
570
|
+
<strong>๐ฏ Comprehensive Detection</strong>
|
|
571
|
+
<p style="font-size: 0.85rem; margin-top: 4px;">Browser, OS, CPU, GPU, RAM, network, battery, and more from a single library</p>
|
|
572
|
+
</div>
|
|
573
|
+
<div class="feature-item">
|
|
574
|
+
<strong>โก Performance-First</strong>
|
|
575
|
+
<p style="font-size: 0.85rem; margin-top: 4px;">Minimal bundle size with tree-shakeable exportsโimport only what you need</p>
|
|
576
|
+
</div>
|
|
577
|
+
<div class="feature-item">
|
|
578
|
+
<strong>๐ฎ Future-Proof</strong>
|
|
579
|
+
<p style="font-size: 0.85rem; margin-top: 4px;">Built on modern Web APIs with graceful fallbacks for older browsers</p>
|
|
580
|
+
</div>
|
|
581
|
+
<div class="feature-item">
|
|
582
|
+
<strong>๐ช Apple Silicon Ready</strong>
|
|
583
|
+
<p style="font-size: 0.85rem; margin-top: 4px;">Advanced detection for Apple M-series chips (M1, M2, M3, M4, and beyond)</p>
|
|
584
|
+
</div>
|
|
585
|
+
<div class="feature-item">
|
|
586
|
+
<strong>๐ Privacy-Conscious</strong>
|
|
587
|
+
<p style="font-size: 0.85rem; margin-top: 4px;">Implements caching for network requests to minimize external API calls</p>
|
|
588
|
+
</div>
|
|
589
|
+
<div class="feature-item">
|
|
590
|
+
<strong>๐ฆ Zero Dependencies</strong>
|
|
591
|
+
<p style="font-size: 0.85rem; margin-top: 4px;">No external runtime dependenciesโjust pure, optimized JavaScript</p>
|
|
592
|
+
</div>
|
|
593
|
+
</div>
|
|
594
|
+
|
|
595
|
+
<h2>Common Use Cases</h2>
|
|
596
|
+
|
|
597
|
+
<h3>1. Adaptive User Interfaces</h3>
|
|
598
|
+
<p>Dynamically adjust your UI based on device capabilities and screen properties:</p>
|
|
599
|
+
<pre><code>const info = await akiInfoDetect();
|
|
600
|
+
if (info.isMobile) {
|
|
601
|
+
loadMobileUI();
|
|
602
|
+
} else if (info.RAM < 4) {
|
|
603
|
+
enableLowMemoryMode();
|
|
604
|
+
}</code></pre>
|
|
605
|
+
|
|
606
|
+
<h3>2. Analytics & User Insights</h3>
|
|
607
|
+
<p>Gather detailed technical data to understand your user base:</p>
|
|
608
|
+
<pre><code>const info = await akiInfoDetect();
|
|
609
|
+
analytics.track('page_view', {
|
|
610
|
+
browser: info.browser,
|
|
611
|
+
os: info.os.string,
|
|
612
|
+
device: info.isMobile ? 'mobile' : 'desktop',
|
|
613
|
+
gpu: info.GPU
|
|
614
|
+
});</code></pre>
|
|
615
|
+
|
|
616
|
+
<h3>3. Feature Detection & Progressive Enhancement</h3>
|
|
617
|
+
<p>Enable or disable features based on browser capabilities:</p>
|
|
618
|
+
<pre><code>const info = await akiInfoDetect();
|
|
619
|
+
const chromeVersion = parseInt(info.browser.split(' ')[1]);
|
|
620
|
+
if (info.browser.includes('Chrome') && chromeVersion >= 90) {
|
|
621
|
+
enableAdvancedFeatures();
|
|
622
|
+
}</code></pre>
|
|
623
|
+
|
|
624
|
+
<h3>4. Platform-Specific Optimization</h3>
|
|
625
|
+
<p>Optimize content delivery based on hardware capabilities:</p>
|
|
626
|
+
<pre><code>const info = await akiInfoDetect();
|
|
627
|
+
if (info.CPU === 'Apple Silicon') {
|
|
628
|
+
loadWebPImages();
|
|
629
|
+
} else if (info.GPU.includes('NVIDIA')) {
|
|
630
|
+
enableHardwareAcceleration();
|
|
631
|
+
}</code></pre>
|
|
632
|
+
|
|
633
|
+
<h3>5. Network-Aware Loading</h3>
|
|
634
|
+
<p>Adapt content loading strategies based on connection quality:</p>
|
|
635
|
+
<pre><code>const info = await akiInfoDetect();
|
|
636
|
+
const conn = info.getConnection();
|
|
637
|
+
if (conn.type === '4g' && conn.downlink > 5) {
|
|
638
|
+
loadHDContent();
|
|
639
|
+
} else {
|
|
640
|
+
loadCompressedContent();
|
|
641
|
+
}</code></pre>
|
|
642
|
+
|
|
643
|
+
<h2>Comparison with Similar Libraries</h2>
|
|
644
|
+
<p>aki-info-detect stands out from other detection libraries with its modern approach and comprehensive feature set:</p>
|
|
645
|
+
|
|
646
|
+
<div style="overflow-x: auto; margin: 20px 0;">
|
|
647
|
+
<table style="width: 100%; border-collapse: collapse; font-size: 0.9rem;">
|
|
648
|
+
<thead>
|
|
649
|
+
<tr style="border-bottom: 2px solid var(--border);">
|
|
650
|
+
<th style="text-align: left; padding: 10px; color: var(--text-primary);">Feature</th>
|
|
651
|
+
<th style="text-align: center; padding: 10px; color: var(--accent);">aki-info-detect</th>
|
|
652
|
+
<th style="text-align: center; padding: 10px; color: var(--text-secondary);">Platform.js</th>
|
|
653
|
+
<th style="text-align: center; padding: 10px; color: var(--text-secondary);">UA-Parser.js</th>
|
|
654
|
+
<th style="text-align: center; padding: 10px; color: var(--text-secondary);">Detect.js</th>
|
|
655
|
+
</tr>
|
|
656
|
+
</thead>
|
|
657
|
+
<tbody>
|
|
658
|
+
<tr style="border-bottom: 1px solid var(--border);">
|
|
659
|
+
<td style="padding: 10px; color: var(--text-secondary);">Bundle Size (gzipped)</td>
|
|
660
|
+
<td style="padding: 10px; text-align: center; color: var(--success);">~3.8 kB</td>
|
|
661
|
+
<td style="padding: 10px; text-align: center;">~2.5 kB</td>
|
|
662
|
+
<td style="padding: 10px; text-align: center;">~9 kB</td>
|
|
663
|
+
<td style="padding: 10px; text-align: center;">Varies</td>
|
|
664
|
+
</tr>
|
|
665
|
+
<tr style="border-bottom: 1px solid var(--border);">
|
|
666
|
+
<td style="padding: 10px; color: var(--text-secondary);">Client Hints API</td>
|
|
667
|
+
<td style="padding: 10px; text-align: center; color: var(--success);">โ
</td>
|
|
668
|
+
<td style="padding: 10px; text-align: center; color: var(--error);">โ</td>
|
|
669
|
+
<td style="padding: 10px; text-align: center; color: var(--error);">โ</td>
|
|
670
|
+
<td style="padding: 10px; text-align: center; color: var(--error);">โ</td>
|
|
671
|
+
</tr>
|
|
672
|
+
<tr style="border-bottom: 1px solid var(--border);">
|
|
673
|
+
<td style="padding: 10px; color: var(--text-secondary);">GPU Detection</td>
|
|
674
|
+
<td style="padding: 10px; text-align: center; color: var(--success);">โ
</td>
|
|
675
|
+
<td style="padding: 10px; text-align: center; color: var(--error);">โ</td>
|
|
676
|
+
<td style="padding: 10px; text-align: center; color: var(--error);">โ</td>
|
|
677
|
+
<td style="padding: 10px; text-align: center; color: var(--error);">โ</td>
|
|
678
|
+
</tr>
|
|
679
|
+
<tr style="border-bottom: 1px solid var(--border);">
|
|
680
|
+
<td style="padding: 10px; color: var(--text-secondary);">Apple Silicon Detection</td>
|
|
681
|
+
<td style="padding: 10px; text-align: center; color: var(--success);">โ
(M1-MX)</td>
|
|
682
|
+
<td style="padding: 10px; text-align: center; color: var(--error);">โ</td>
|
|
683
|
+
<td style="padding: 10px; text-align: center; color: var(--error);">โ</td>
|
|
684
|
+
<td style="padding: 10px; text-align: center; color: var(--error);">โ</td>
|
|
685
|
+
</tr>
|
|
686
|
+
<tr style="border-bottom: 1px solid var(--border);">
|
|
687
|
+
<td style="padding: 10px; color: var(--text-secondary);">Network Info (IP/ISP)</td>
|
|
688
|
+
<td style="padding: 10px; text-align: center; color: var(--success);">โ
</td>
|
|
689
|
+
<td style="padding: 10px; text-align: center; color: var(--error);">โ</td>
|
|
690
|
+
<td style="padding: 10px; text-align: center; color: var(--error);">โ</td>
|
|
691
|
+
<td style="padding: 10px; text-align: center; color: var(--error);">โ</td>
|
|
692
|
+
</tr>
|
|
693
|
+
<tr style="border-bottom: 1px solid var(--border);">
|
|
694
|
+
<td style="padding: 10px; color: var(--text-secondary);">Battery & Geolocation</td>
|
|
695
|
+
<td style="padding: 10px; text-align: center; color: var(--success);">โ
</td>
|
|
696
|
+
<td style="padding: 10px; text-align: center; color: var(--error);">โ</td>
|
|
697
|
+
<td style="padding: 10px; text-align: center; color: var(--error);">โ</td>
|
|
698
|
+
<td style="padding: 10px; text-align: center; color: var(--error);">โ</td>
|
|
699
|
+
</tr>
|
|
700
|
+
<tr style="border-bottom: 1px solid var(--border);">
|
|
701
|
+
<td style="padding: 10px; color: var(--text-secondary);">Tree-shakeable</td>
|
|
702
|
+
<td style="padding: 10px; text-align: center; color: var(--success);">โ
</td>
|
|
703
|
+
<td style="padding: 10px; text-align: center; color: var(--text-muted);">โ ๏ธ</td>
|
|
704
|
+
<td style="padding: 10px; text-align: center; color: var(--text-muted);">โ ๏ธ</td>
|
|
705
|
+
<td style="padding: 10px; text-align: center; color: var(--text-muted);">โ ๏ธ</td>
|
|
706
|
+
</tr>
|
|
707
|
+
<tr style="border-bottom: 1px solid var(--border);">
|
|
708
|
+
<td style="padding: 10px; color: var(--text-secondary);">TypeScript Support</td>
|
|
709
|
+
<td style="padding: 10px; text-align: center; color: var(--success);">โ
Full</td>
|
|
710
|
+
<td style="padding: 10px; text-align: center; color: var(--text-muted);">โ ๏ธ Community</td>
|
|
711
|
+
<td style="padding: 10px; text-align: center; color: var(--success);">โ
</td>
|
|
712
|
+
<td style="padding: 10px; text-align: center; color: var(--error);">โ</td>
|
|
713
|
+
</tr>
|
|
714
|
+
<tr>
|
|
715
|
+
<td style="padding: 10px; color: var(--text-secondary);">Active Maintenance</td>
|
|
716
|
+
<td style="padding: 10px; text-align: center; color: var(--success);">โ
</td>
|
|
717
|
+
<td style="padding: 10px; text-align: center; color: var(--text-muted);">โ ๏ธ</td>
|
|
718
|
+
<td style="padding: 10px; text-align: center; color: var(--success);">โ
</td>
|
|
719
|
+
<td style="padding: 10px; text-align: center; color: var(--error);">โ Archived</td>
|
|
720
|
+
</tr>
|
|
721
|
+
</tbody>
|
|
722
|
+
</table>
|
|
723
|
+
</div>
|
|
724
|
+
|
|
725
|
+
<h3>Key Differentiators</h3>
|
|
726
|
+
<ul>
|
|
727
|
+
<li><strong>vs. Platform.js:</strong> Modern evolution with Client Hints API support, hardware detection (GPU, RAM), and network capabilities</li>
|
|
728
|
+
<li><strong>vs. UA-Parser.js:</strong> Lighter bundle while providing more comprehensive information including hardware and network detection</li>
|
|
729
|
+
<li><strong>vs. Detect.js:</strong> Active maintenance (Detect.js is archived), smaller focused API, modern Web API integration</li>
|
|
730
|
+
</ul>
|
|
731
|
+
|
|
732
|
+
<h2>Frequently Asked Questions</h2>
|
|
733
|
+
|
|
734
|
+
<h3>General Questions</h3>
|
|
735
|
+
|
|
736
|
+
<details style="margin: 10px 0; padding: 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; cursor: pointer;">
|
|
737
|
+
<summary style="font-weight: 500; color: var(--text-primary); cursor: pointer;">What browsers does aki-info-detect support?</summary>
|
|
738
|
+
<p style="margin-top: 10px; color: var(--text-secondary);">
|
|
739
|
+
All modern browsers with ES2020+ support: Chrome/Edge 89+, Firefox 88+, Safari 14+, Opera 76+. Client Hints features work best in Chromium-based browsers.
|
|
740
|
+
</p>
|
|
741
|
+
</details>
|
|
742
|
+
|
|
743
|
+
<details style="margin: 10px 0; padding: 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; cursor: pointer;">
|
|
744
|
+
<summary style="font-weight: 500; color: var(--text-primary); cursor: pointer;">Does it work in Node.js or server-side environments?</summary>
|
|
745
|
+
<p style="margin-top: 10px; color: var(--text-secondary);">
|
|
746
|
+
No, aki-info-detect is specifically designed for browser environments. It relies on browser APIs like <code>navigator</code>, <code>screen</code>, and Web APIs that are not available in Node.js.
|
|
747
|
+
</p>
|
|
748
|
+
</details>
|
|
749
|
+
|
|
750
|
+
<details style="margin: 10px 0; padding: 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; cursor: pointer;">
|
|
751
|
+
<summary style="font-weight: 500; color: var(--text-primary); cursor: pointer;">How accurate is the detection?</summary>
|
|
752
|
+
<p style="margin-top: 10px; color: var(--text-secondary);">
|
|
753
|
+
Very accurate for modern browsers that support Client Hints API. For browsers without Client Hints, it falls back to user agent parsing which is still reliable but less detailed. GPU and CPU detection is most accurate in Chromium-based browsers.
|
|
754
|
+
</p>
|
|
755
|
+
</details>
|
|
756
|
+
|
|
757
|
+
<details style="margin: 10px 0; padding: 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; cursor: pointer;">
|
|
758
|
+
<summary style="font-weight: 500; color: var(--text-primary); cursor: pointer;">Is user agent string spoofing a concern?</summary>
|
|
759
|
+
<p style="margin-top: 10px; color: var(--text-secondary);">
|
|
760
|
+
While user agents can be spoofed, Client Hints API provides more reliable detection. For critical functionality, always combine with feature detection rather than relying solely on browser/platform detection.
|
|
761
|
+
</p>
|
|
762
|
+
</details>
|
|
763
|
+
|
|
764
|
+
<h3>Privacy & Security</h3>
|
|
765
|
+
|
|
766
|
+
<details style="margin: 10px 0; padding: 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; cursor: pointer;">
|
|
767
|
+
<summary style="font-weight: 500; color: var(--text-primary); cursor: pointer;">Does aki-info-detect collect or transmit user data?</summary>
|
|
768
|
+
<p style="margin-top: 10px; color: var(--text-secondary);">
|
|
769
|
+
No. The library only detects information locally in the browser. The optional network info feature (<code>getNetworkInfo()</code>) makes a request to a public IP API, but this is only triggered when you explicitly call that method.
|
|
770
|
+
</p>
|
|
771
|
+
</details>
|
|
772
|
+
|
|
773
|
+
<details style="margin: 10px 0; padding: 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; cursor: pointer;">
|
|
774
|
+
<summary style="font-weight: 500; color: var(--text-primary); cursor: pointer;">What about user privacy?</summary>
|
|
775
|
+
<p style="margin-top: 10px; color: var(--text-secondary);">
|
|
776
|
+
aki-info-detect is privacy-conscious. Network requests are cached for 1 hour to minimize external API calls, and all detection happens client-side. No data is sent to our servers.
|
|
777
|
+
</p>
|
|
778
|
+
</details>
|
|
779
|
+
|
|
780
|
+
<details style="margin: 10px 0; padding: 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; cursor: pointer;">
|
|
781
|
+
<summary style="font-weight: 500; color: var(--text-primary); cursor: pointer;">Is it GDPR compliant?</summary>
|
|
782
|
+
<p style="margin-top: 10px; color: var(--text-secondary);">
|
|
783
|
+
Detection of browser/device information is generally considered functional data necessary for website operation. However, always review your local regulations and privacy policies, especially when using geolocation or storing detected data.
|
|
784
|
+
</p>
|
|
785
|
+
</details>
|
|
786
|
+
|
|
787
|
+
<h3>Technical Questions</h3>
|
|
788
|
+
|
|
789
|
+
<details style="margin: 10px 0; padding: 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; cursor: pointer;">
|
|
790
|
+
<summary style="font-weight: 500; color: var(--text-primary); cursor: pointer;">Why do I need to configure server headers?</summary>
|
|
791
|
+
<p style="margin-top: 10px; color: var(--text-secondary);">
|
|
792
|
+
The Client Hints API requires the server to explicitly request detailed information via <code>Accept-CH</code> headers. Without these headers, browsers will only provide basic user agent data. This is a browser security feature designed to enhance user privacy.
|
|
793
|
+
</p>
|
|
794
|
+
</details>
|
|
795
|
+
|
|
796
|
+
<details style="margin: 10px 0; padding: 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; cursor: pointer;">
|
|
797
|
+
<summary style="font-weight: 500; color: var(--text-primary); cursor: pointer;">Can I use it with React, Vue, or other frameworks?</summary>
|
|
798
|
+
<p style="margin-top: 10px; color: var(--text-secondary);">
|
|
799
|
+
Absolutely! aki-info-detect is framework-agnostic. Check the Documentation tab for React Hook and Vue Composable examples.
|
|
800
|
+
</p>
|
|
801
|
+
</details>
|
|
802
|
+
|
|
803
|
+
<details style="margin: 10px 0; padding: 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; cursor: pointer;">
|
|
804
|
+
<summary style="font-weight: 500; color: var(--text-primary); cursor: pointer;">How do I reduce bundle size further?</summary>
|
|
805
|
+
<p style="margin-top: 10px; color: var(--text-secondary);">
|
|
806
|
+
Use tree-shakeable imports to include only the functions you need:
|
|
807
|
+
<pre style="margin-top: 8px;"><code>import { detectBrowser, detectOS } from 'aki-info-detect';</code></pre>
|
|
808
|
+
</p>
|
|
809
|
+
</details>
|
|
810
|
+
|
|
811
|
+
<details style="margin: 10px 0; padding: 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; cursor: pointer;">
|
|
812
|
+
<summary style="font-weight: 500; color: var(--text-primary); cursor: pointer;">Does it support TypeScript?</summary>
|
|
813
|
+
<p style="margin-top: 10px; color: var(--text-secondary);">
|
|
814
|
+
Yes, full TypeScript declarations are included in the package.
|
|
815
|
+
</p>
|
|
816
|
+
</details>
|
|
817
|
+
|
|
818
|
+
<details style="margin: 10px 0; padding: 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; cursor: pointer;">
|
|
819
|
+
<summary style="font-weight: 500; color: var(--text-primary); cursor: pointer;">How often is the network information cached?</summary>
|
|
820
|
+
<p style="margin-top: 10px; color: var(--text-secondary);">
|
|
821
|
+
Network info (IP, ISP, country) is cached for 1 hour by default. You can force a refresh by passing <code>true</code> to <code>getNetworkInfo(true)</code>.
|
|
822
|
+
</p>
|
|
823
|
+
</details>
|
|
824
|
+
|
|
825
|
+
<h3>Troubleshooting</h3>
|
|
826
|
+
|
|
827
|
+
<details style="margin: 10px 0; padding: 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; cursor: pointer;">
|
|
828
|
+
<summary style="font-weight: 500; color: var(--text-primary); cursor: pointer;">Why am I getting generic hardware info?</summary>
|
|
829
|
+
<p style="margin-top: 10px; color: var(--text-secondary);">
|
|
830
|
+
Make sure your server is configured to send the required <code>Accept-CH</code> headers. Without these headers, detailed Client Hints data won't be available. Check the Documentation tab for server configuration examples.
|
|
831
|
+
</p>
|
|
832
|
+
</details>
|
|
833
|
+
|
|
834
|
+
<details style="margin: 10px 0; padding: 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; cursor: pointer;">
|
|
835
|
+
<summary style="font-weight: 500; color: var(--text-primary); cursor: pointer;">Why is GPU detection returning "Unknown"?</summary>
|
|
836
|
+
<p style="margin-top: 10px; color: var(--text-secondary);">
|
|
837
|
+
GPU detection works best in Chromium browsers with Client Hints. Safari and Firefox have limited support. Also, some browsers may restrict this information for privacy reasons.
|
|
838
|
+
</p>
|
|
839
|
+
</details>
|
|
840
|
+
|
|
841
|
+
<details style="margin: 10px 0; padding: 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; cursor: pointer;">
|
|
842
|
+
<summary style="font-weight: 500; color: var(--text-primary); cursor: pointer;">The library says "Unknown" for many fields. What's wrong?</summary>
|
|
843
|
+
<p style="margin-top: 10px; color: var(--text-secondary);">
|
|
844
|
+
Check browser console for errors, ensure you're using a supported browser version, and verify that your server is sending proper Client Hints headers (see the Documentation tab for Server Configuration).
|
|
845
|
+
</p>
|
|
846
|
+
</details>
|
|
847
|
+
|
|
848
|
+
<div class="note-box" style="margin-top: 24px;">
|
|
849
|
+
<strong>๐ Ready to get started?</strong> Check out the <strong>Demo</strong> tab to see the library in action, or visit the <strong>Documentation</strong> tab for installation instructions and code examples.
|
|
850
|
+
</div>
|
|
851
|
+
</div>
|
|
852
|
+
</div>
|
|
853
|
+
|
|
551
854
|
<!-- Demo Tab -->
|
|
552
|
-
<div class="tab-content
|
|
855
|
+
<div class="tab-content" id="demo">
|
|
553
856
|
<div class="note-box">
|
|
554
857
|
<strong>โ ๏ธ Server Headers Required:</strong> For deep hardware detection via Client Hints API, configure:
|
|
555
858
|
<code>Accept-CH: Sec-CH-UA, Sec-CH-UA-Mobile, Sec-CH-UA-Platform, Sec-CH-UA-Platform-Version, Sec-CH-UA-Arch, Sec-CH-UA-Bitness</code>
|
package/package.json
CHANGED