Last active
November 24, 2018 06:34
-
-
Save overdodactyl/934ab50cad62166e3a108210e141bcc8 to your computer and use it in GitHub Desktop.
A simple test, based on access to IndexedDB, to determine if Firefox is in private browsing mode.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>PB Test</title> | |
<meta name="author" content="overdodactyl"> | |
</head> | |
<body> | |
<h1>Private Browsing Test</h1> | |
<p>This is a simple test, based on access to IndexedDB, to determine if Firefox is in private browsing mode.</p> | |
<p id="test">Testing...</p> | |
<script> | |
var db = indexedDB.open("test"); | |
var result = document.getElementById("test"); | |
db.onerror = function(){ | |
result.innerHTML = "Private Browsing detected!"; | |
result.style.color = 'red'; | |
}; | |
db.onsuccess =function(){ | |
result.innerHTML = "Private Browsing not detected!"; | |
result.style.color = 'green'; | |
}; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment