On a specific website I am unable to detect if the browser is edge (chromium) because on that website I am getting following user agent on edge browser
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Safari/537.36"
There is no "edge" or "edg" keyword to detect if it's edge is there any work around for this issue.
I need to just differentiate between these two browsers only, here is my code for detection.
public isChrome(): boolean {
return /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
}
public isEdge(): boolean {
return /edg|edge/.test(navigator.userAgent.toLowerCase()) && /Google Inc/.test(navigator.vendor);
}
thanks