Skip to content

Instantly share code, notes, and snippets.

@naveenyagati
Last active August 1, 2019 11:10
Show Gist options
  • Save naveenyagati/d7f0f09c8ac10b56392f824f2190091b to your computer and use it in GitHub Desktop.
Save naveenyagati/d7f0f09c8ac10b56392f824f2190091b to your computer and use it in GitHub Desktop.
Chrome Incognito Detection
<script >
if ('storage' in navigator && 'estimate' in navigator.storage) {
navigator.storage.estimate()
.then(function(estimate){
console.log(`Using ${estimate.usage/1e+6} out of ${estimate.quota/1e+6} bytes.`);
if(estimate.quota/1e+6 < 116.361073){
alert("Why Incognito ?");
}});
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment