
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
smart-browser-detection
Advanced tools
Smart browser detection library with anti-spoofing capabilities, multi-method detection, and mobile browser support. Outperforms UA-Parser-JS with superior accuracy and spoofing resistance.
The Smartest Browser Detection Library - Outperforms UA-Parser-JS with superior accuracy, anti-spoofing capabilities, and comprehensive mobile browser support.
Unlike UA-Parser-JS and other libraries that rely solely on User-Agent strings (which can be easily spoofed), our library uses multiple detection methods including:
Our library doesn't just detect browsers - it provides confidence scores for each detection, ensuring you know how reliable the result is.
npm install smart-browser-detection
<script src="https://unpkg.com/smart-browser-detection/dist/smart-browser-detection.min.js"></script>
<script>
const detector = new SmartBrowserDetection();
const result = detector.detectBrowser();
console.log(result);
// Output: { browser: 'Chrome', confidence: 0.9, isMobile: false, ... }
</script>
import { SmartBrowserDetection, BrowserDetectionResult } from 'smart-browser-detection';
const detector = new SmartBrowserDetection();
const result: BrowserDetectionResult = detector.detectBrowser();
const { SmartBrowserDetection } = require('smart-browser-detection');
const detector = new SmartBrowserDetection();
const result = detector.detectBrowser();
The library includes comprehensive TypeScript definitions:
import {
SmartBrowserDetection,
BrowserDetectionResult,
DetectionMethodResult,
BrowserType,
PlatformType,
OSType,
EngineType
} from 'smart-browser-detection';
const detector = new SmartBrowserDetection();
const result: BrowserDetectionResult = detector.detectBrowser();
const browser: BrowserType = result.browser;
const platform: PlatformType = detector.getPlatform();
detectBrowser()Main detection method that combines all detection algorithms.
const result = detector.detectBrowser();
Returns:
{
browser: 'Chrome', // Browser name
browserVersion: '120.0.0', // Browser version
engine: 'Blink', // Rendering engine
engineVersion: '120.0.0', // Engine version
platform: 'Desktop', // Platform type
os: 'Windows', // Operating system
osVersion: 'Windows 10/11', // OS version
isMobile: false, // Mobile device flag
isTablet: false, // Tablet device flag
isDesktop: true, // Desktop device flag
confidence: 0.9, // Detection confidence (0-1)
detectionMethods: ['apiDetection', 'vendorDetection'], // Methods used
userAgent: '...', // Original user agent
vendor: 'Google Inc.' // Browser vendor
}
getCompleteInfo()Get comprehensive browser and device information.
const info = detector.getCompleteInfo();
getBrowserVersion()Get browser version specifically.
const version = detector.getBrowserVersion();
getOSInfo()Get operating system information.
const { os, osVersion } = detector.getOSInfo();
const detector = new EnhancedBrowserDetection();
// Check if specific detection method is available
if (detector.detectionMethods.includes('apiDetection')) {
const apiResult = detector.apiDetection();
console.log('API Detection Result:', apiResult);
}
const result = detector.detectBrowser();
if (result.confidence >= 0.8) {
console.log('High confidence detection:', result.browser);
} else if (result.confidence >= 0.6) {
console.log('Medium confidence detection:', result.browser);
} else {
console.log('Low confidence - using fallback');
}
const result = detector.detectBrowser();
if (result.isMobile) {
console.log('Mobile browser detected:', result.browser);
console.log('Platform:', result.platform);
}
Uses browser-specific JavaScript APIs for high-confidence detection:
window.chrome.runtimewindow.InstallTriggerwindow.safari.pushNotificationnavigator.userAgentData.brandsAnalyzes navigator.vendor and related properties:
Enhanced UA parsing with priority handling:
Uses browser-specific CSS features:
| Feature | Smart Browser Detection | UA-Parser-JS | Bowser | Platform.js |
|---|---|---|---|---|
| Anti-Spoofing | ✅ Multi-method | ❌ UA-only | ❌ UA-only | ❌ UA-only |
| Mobile Edge Detection | ✅ Accurate | ❌ Often wrong | ❌ Often wrong | ❌ Often wrong |
| Confidence Scoring | ✅ Built-in | ❌ No | ❌ No | ❌ No |
| API Detection | ✅ Yes | ❌ No | ❌ No | ❌ No |
| CSS Detection | ✅ Yes | ❌ No | ❌ No | ❌ No |
| Bundle Size | 🟡 15KB | 🟢 8KB | 🟢 6KB | 🟢 4KB |
| Accuracy | 🟢 95%+ | 🟡 85% | 🟡 80% | 🟡 75% |
# Run tests
npm test
# Run tests with coverage
npm run test:coverage
# Run tests in watch mode
npm run test:watch
npm run benchmark
Results (vs UA-Parser-JS):
We welcome contributions! Please see our Contributing Guide for details.
MIT License - see LICENSE file for details.
Made with ❤️ for smart browser detection
FAQs
Smart browser detection library with anti-spoofing capabilities, multi-method detection, and mobile browser support. Outperforms UA-Parser-JS with superior accuracy and spoofing resistance.
We found that smart-browser-detection demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.