File tree 1 file changed +2
-1
lines changed
1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -238,6 +238,8 @@ export function getCurrentProduct(): Product {
238
238
case Runtime . Fastly :
239
239
return Product . Fastly ;
240
240
case Runtime . Browser : {
241
+ // Brave can not be detected from user agent string, handle separately
242
+ if ( verifyGlobal ( "brave" ) && "brave" in navigator ) return Product . Brave ;
241
243
// For browser, get the specific browser
242
244
const userAgent = navigator . userAgent ;
243
245
return getProductFromUserAgent ( userAgent ) ;
@@ -252,7 +254,6 @@ export function getCurrentProduct(): Product {
252
254
*/
253
255
export function getProductFromUserAgent ( userAgent : string ) : Product {
254
256
if ( userAgent . indexOf ( "Opera" ) !== - 1 || userAgent . indexOf ( "OPR" ) !== - 1 ) return Product . Opera ;
255
- if ( "brave" in navigator ) return Product . Brave ;
256
257
if ( userAgent . indexOf ( "Safari" ) !== - 1 && userAgent . indexOf ( "Chrome" ) === - 1 ) return Product . Safari ;
257
258
if ( userAgent . indexOf ( "Edg" ) !== - 1 ) return Product . Edge ;
258
259
if ( userAgent . indexOf ( "Chrome" ) !== - 1 ) return Product . Chrome ;
You can’t perform that action at this time.
0 commit comments