You can find two current methods here:
Here's a script from the first method that detects Incognito with JS:
<script async>
async function start() {
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){
alert('We see you! You are incognito!')
console.log('Incognito')
} else {
alert('Not incognito!')
console.log('Not Incognito')
}
} else {
console.log('Can not detect')
}
}
start();
</script>`