I want to detect if the browser is chrome. I came across a lot of answers but all of them return true also for opera and the new version of edge. I was wondering if you have the best way to detect if the browser is chrome
[edit] Code i've tested so far that return true :
//Test 1 => Opera and edge returns true
var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
// Test 2 => return false for chrome latest version
var isChrome = !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime);
//Test 3 => same as test 1
var is_chrome = /chrome/i.test( navigator.userAgent );