Saturday, May 11, 2024
 Popular · Latest · Hot · Upcoming
80
rated 0 times [  83] [ 3]  / answers: 1 / hits: 17447  / 8 Years ago, sat, april 9, 2016, 12:00:00

I have been messing around with the Brave browser (https://www.brave.com/), an I cannot figure out how to determine how if a user is using Brave. I used a simple document to output the user agent:





<script>document.write(navigator.userAgent);</script>





and I get:




Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.108 Safari/537.36




which doesn't really help me in my situation. Does anyone know how to determine anyone using Brave in PHP or JavaScript? Thanks!


More From » php

 Answers
10

Kohjah Breese's solution isn't working to detect Brave on Android (e.g. Chrome is detected as Brave). But as he said If you search DuckDuckGo for [what's my user agent] they will return Brave. Then you can use the API of Duckduckgo to know if they browser is Brave :



var request = new XMLHttpRequest()

request.open('GET', 'https://api.duckduckgo.com/?q=useragent&format=json', true)

request.onload = function () {
var data = JSON.parse(this.response)
var isBrave = data['Answer'].includes('Brave');
if(isBrave){
console.log( isBrave );
}
}

request.send()

[#62635] Wednesday, April 6, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
stefanicarolinat

Total Points: 145
Total Questions: 91
Total Answers: 93

Location: Cambodia
Member since Thu, Oct 7, 2021
3 Years ago
stefanicarolinat questions
Mon, Nov 15, 21, 00:00, 3 Years ago
Fri, Apr 16, 21, 00:00, 3 Years ago
Thu, Oct 15, 20, 00:00, 4 Years ago
Fri, Jul 17, 20, 00:00, 4 Years ago
;