A lightweight, open-source JavaScript library for detecting incognito mode, physical user activity (such as walking, sitting, or standing), and device storage.
- 🕵️ Incognito Mode Detection - Works across Chrome, Brave, Firefox, Safari, Edge, and Opera
- 🚶 Activity Detection - Real-time user activity monitoring (Standing, Sitting, Walking, Lying down)
- 💾 Storage Information - Device storage usage and capacity
- 🎯 Modular Design - Enable only what you need for optimal performance
- ⚡ Lightweight - Only ~8KB minified
- 🔧 Zero Dependencies - No external libraries required
- 📱 Mobile Friendly - Full support for iOS and Android devices
Add the library to your HTML file:
<script src="https://cdn.jsdelivr.net/gh/worm0x1/PrivaSense/PrivaSense.js"></script>That's it! The library will automatically load all required dependencies.
// Enable only the features you need
const ps = new PrivaSense({
incognito: true, // ✅ Enable incognito detection
activity: false, // ❌ Disable activity detection
storage: true // ✅ Enable storage detection
});
// Get all enabled information
const info = await ps.getInfo();
console.log(info);
// Output: { incognito: '🟢 Public', storage: '32 GB / 128 GB' }new PrivaSense({
incognito: boolean, // Enable incognito detection (default: true)
activity: boolean, // Enable activity detection (default: true)
storage: boolean, // Enable storage detection (default: true)
normalLabel: string, // Custom label for normal mode (default: '🟢 Public')
incognitoLabel: string, // Custom label for incognito mode (default: '🔴 Private')
historyLength: number, // Motion history buffer (default: 100)
walkingThreshold: number // Walking detection threshold (default: 2.0)
})Returns all enabled features' information.
const info = await ps.getInfo();
// Returns object with only enabled featuresDetects incognito/private mode. Requires: incognito: true
const result = await ps.detectIncognito();
// Returns: '🟢 Public' (Normal) or '🔴 Private' (Incognito)Gets current user activity. Requires: activity: true
const activity = await ps.getActivity();
// Returns: 'Standing or Sitting' | 'Walking or riding' | 'Lying down' | 'Unknown'Gets device storage info. Requires: storage: true
const storage = await ps.getStorage();
// Returns: '32 GB / 128 GB' or 'Unknown'Perfect for privacy-focused websites.
const ps = new PrivaSense({ incognito: true, activity: false, storage: false });
const info = await ps.getInfo();
if (info.incognito === '🔴 Private') {
alert('Please disable incognito mode for full functionality');
}Great for fitness or health apps.
<div id="activity">Detecting...</div>
<script src="https://cdn.jsdelivr.net/gh/worm0x1/PrivaSense/PrivaSense.js"></script>
<script>
const ps = new PrivaSense({ incognito: false, activity: true, storage: false });
setInterval(async () => {
const info = await ps.getInfo();
document.getElementById('activity').textContent = info.activity;
}, 2000);
</script>Useful for storage management apps.
const ps = new PrivaSense({ incognito: false, activity: false, storage: true });
const info = await ps.getInfo();
console.log('Available storage:', info.storage);const ps = new PrivaSense({
incognito: true,
activity: false,
storage: true
});
const info = await ps.getInfo();
console.log(info);
// { incognito: '🟢 Public', storage: '32 GB / 128 GB' }<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PrivaSense Demo</title>
<style>
.info-card {
padding: 20px;
margin: 10px 0;
border: 2px solid #0066cc;
border-radius: 10px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
}
.value {
font-size: 28px;
font-weight: bold;
margin-top: 10px;
}
</style>
</head>
<body>
<h1>📱 Device Information Dashboard</h1>
<div class="info-card">
<h3>🕵️ Browsing Mode</h3>
<div class="value" id="incognito">Loading...</div>
</div>
<div class="info-card">
<h3>🚶 Current Activity</h3>
<div class="value" id="activity">Loading...</div>
</div>
<div class="info-card">
<h3>💾 Storage</h3>
<div class="value" id="storage">Loading...</div>
</div>
<script src="https://cdn.jsdelivr.net/gh/worm0x1/PrivaSense/PrivaSense.js"></script>
<script>
const ps = new PrivaSense({
incognito: true,
activity: true,
storage: true
});
async function updateInfo() {
const info = await ps.getInfo();
document.getElementById('incognito').textContent = info.incognito;
document.getElementById('activity').textContent = info.activity;
document.getElementById('storage').textContent = info.storage;
}
updateInfo();
setInterval(updateInfo, 3000);
</script>
</body>
</html>// With custom emoji labels (like the old default)
const ps = new PrivaSense({
incognito: true,
normalLabel: '✅',
incognitoLabel: '❌'
});
const info = await ps.getInfo();
console.log(info.incognito); // Output: '✅' or '❌'
// With custom text labels
const ps2 = new PrivaSense({
incognito: true,
normalLabel: 'Normal Mode',
incognitoLabel: 'Incognito Mode'
});
// Mix text and emoji
const ps3 = new PrivaSense({
incognito: true,
normalLabel: '✅ Normal Browsing',
incognitoLabel: '❌ Private Browsing'
});// 1️⃣ Single Feature
const ps1 = new PrivaSense({ incognito: true, activity: false, storage: false });
const ps2 = new PrivaSense({ incognito: false, activity: true, storage: false });
const ps3 = new PrivaSense({ incognito: false, activity: false, storage: true });
// 2️⃣ Two Features
const ps4 = new PrivaSense({ incognito: true, activity: false, storage: true });
const ps5 = new PrivaSense({ incognito: false, activity: true, storage: true });
const ps6 = new PrivaSense({ incognito: true, activity: true, storage: false });
// 3️⃣ All Features (Default)
const ps7 = new PrivaSense({
incognito: true,
activity: true,
storage: true
});
// Or simply:
const ps8 = new PrivaSense();
// 4️⃣ Custom Configuration
const ps9 = new PrivaSense({
incognito: false,
activity: true,
storage: false,
historyLength: 150, // Longer motion history
walkingThreshold: 2.5 // More sensitive walking detection
});| Use Case | Configuration | Best For |
|---|---|---|
| Privacy Check | { incognito: true, activity: false, storage: false } |
Banking, E-commerce sites |
| Fitness Tracking | { incognito: false, activity: true, storage: false } |
Health apps, Step counters |
| Storage Manager | { incognito: false, activity: false, storage: true } |
File managers, Cloud storage apps |
| Security Dashboard | { incognito: true, activity: false, storage: true } |
Admin panels, Security tools |
| Complete Monitoring | All three enabled | Device info dashboards |
PrivaSense only loads what you enable:
| Configuration | Load Time | CPU Usage |
|---|---|---|
| Single feature | < 5ms | Minimal |
| Two features | < 10ms | Low |
| All features | < 15ms | Low |
| Browser | Incognito Detection | Activity Detection | Storage Detection |
|---|---|---|---|
| Chrome | ✅ | ✅ | ✅ |
| Brave | ✅ | ❌ | ❌ |
| Firefox | ✅ | ✅ | ❌ |
| Safari | ✅ | ✅ | ✅ |
| Edge | ✅ | ✅ | ✅ |
| Opera | ✅ | ✅ | ✅ |
Note: Activity detection requires device motion sensors (available on most mobile devices and some laptops).
For activity detection on iOS 13+, you need to request permission:
if (typeof DeviceMotionEvent.requestPermission === 'function') {
const permission = await DeviceMotionEvent.requestPermission();
if (permission === 'granted') {
const ps = new PrivaSense({ activity: true });
// Now you can use activity detection
}
} else {
// Non-iOS device, no permission needed
const ps = new PrivaSense({ activity: true });
}If you try to call a method for a disabled feature:
const ps = new PrivaSense({ incognito: true, activity: false, storage: false });
try {
await ps.getActivity(); // This will throw an error
} catch (error) {
console.error(error.message);
// "Activity detection is not enabled. Initialize with { activity: true }"
}- Default:
'🟢 Public'(Normal) /'🔴 Private'(Incognito) - Custom: আপনার দেওয়া
normalLabelএবংincognitoLabelরিটার্ন করবে
"Standing or Sitting""Walking or riding""Lying down""Unknown"- When motion tracking hasn't initialized yet"Sensor not supported"- When device doesn't support motion sensors
"32 GB / 128 GB"- (Used / Total)"128 GB"- (Only total if used is 0)"Unknown"- If API unavailable
License - Free to use in personal and commercial projects