For some website we're working on, I've been asked to detect if users are using the Tor browser.
Looking around this came up: https://stackoverflow.com/a/28202492
From that answer, a quick and dirty way of detecting the Tor browser would be to check client-side for the equality of the innerHeight and availHeight properties (plus their width analogues). At the moment, I have JavaScript like the following:
var detect_tor_browser = function () {
return (window.screen.availHeight === window.innerHeight) && (window.screen.availWidth === window.innerWidth);
}
In my admittedly limited testing, this seems to work.
Why can I sometimes detect the Tor browser by checking for equality of those properties client-side?