JSFiddle - React, Tailwind, and code Playground
HTML
<h1>Checks if you are in incognito mode</h1>
<div id="result"></div>
JavaScript 1.7
async function main() {
if ('storage' in navigator && 'estimate' in navigator.storage) {
const {usage, quota} = await navigator.storage.estimate();
console.log(`Using ${usage} out of ${quota} bytes.`);
if(quota < 120000000){
result.textContent = "it seems like you are in incognito mode";
} else {
result.textContent = "it does not seem like you are in incognito mode";
}
} else {
result.textContent = "check failed?";
}
}
main();