How do I tell if a user is using Brave as their browser?
There is a way to check if the user is using brave without any api calls. I created the below function that returns false or True if its Brave
function isBrave() {
if (window.navigator.brave != undefined) {
if (window.navigator.brave.isBrave.name == "isBrave") {
return true;
} else {
return false;
}
} else {
return false;
}
}
document.getElementById("ans").innerHTML = isBrave();
Is this Brave? <span id="ans"></span>
As of April 2020, you can use this detection method to get a boolean answer to whether the user is using Brave or not:
(navigator.brave && await navigator.brave.isBrave() || false)
The "Brave" in the user agent was removed in the 0.9 version.
From the changelog:
Removed Brave from the User Agent HTTP header to reduce fingerprinting.