One way is to visit the unique URL and then check if the link to this URL is considered as visited CSS.
You can see an example of this in "Incognito Detection" (Dead link).
Research paper by the same author to replace Incognito Discovery link above
In main.html
add iframe,
<iframe id='testFrame' name='testFrame' onload='setUniqueSource(this)' src='' style="width:0; height:0; visibility:hidden;"></iframe>
and some JavaScript code:
function checkResult() { var a = frames[0].document.getElementById('test'); if (!a) return; var color; if (a.currentStyle) { color = a.currentStyle.color; } else { color = frames[0].getComputedStyle(a, '').color; } var visited = (color == 'rgb(51, 102, 160)' || color == '#3366a0'); alert('mode is ' + (visited ? 'NOT Private' : 'Private')); } function setUniqueSource(frame) { frame.src = "test.html?" + Math.random(); frame.onload = ''; }
Then in test.html
, which are loaded in the iFrame:
<style> a:link { color: #336699; } a:visited { color: #3366A0; } </style> <script> setTimeout(function() { var a = document.createElement('a'); a.href = location; a.id = 'test'; document.body.appendChild(a); parent.checkResult(); }, 100); </script>
NOTE. Try this from the file system to scream Chrome about "Unsafe Javascript." This will work, however, from a web server.
JHurrah May 26 '10 at 12:15 a.m. 2010-05-26 00:15
source share