Comment by AdriaanvRossum
4 years ago
Too bad they don't show in the User Agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko)
Would love to show the amount of visitors in Simple Analytics dashboards. [1]
Does anybody know a way to detect the DuckDuckGo browser?
> Does anybody know a way to detect the DuckDuckGo browser?
Only in the DDG iOS app the useragent adds a DuckDuckGo string appended to a generic Safari string. You can test here:
https://duckduckgo.com/?q=what+is+my+useragent&ia=answer
Brave does something similar. It just looks like a generic version of chrome
It didn't always have a generic Chrome UA, if you go here[0] it had 'Brave' somewhere in the string, which you could fix by turning on fingerprinting prevention. Glad they fixed that. I don't want people to know I use Brave, although I'm sure there's ways to detect Brave with JS.
[0] https://duckduckgo.com/?q=what+is+my+useragent&ia=answer
You can do `await navigator.brave.isBrave()` to detect Brave.
[1] https://github.com/brave/brave-browser/issues/24478
They seem to set something on `window.navigator._duckduckgoloader_`
If you run `JSON.stringify(window.navigator)`, it only shows the _duckduckgoloader_ variable. Anybody knows why JSON.stringify behaves like that?
JSON.stringify is outputting the "own, enumerable" properties. The default properties of window.navigator aren't enumerable and/or come through the prototype chain.
The rules for JSON.stringify are actually pretty complicated: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Thanks for sharing!