Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Chrome 71 detection in Javascript

Since Google Chrome 71, using !!window.chrome && !!window.chrome.webstore; to detect Google Chrome in javascript doesn't work anymore. It's pretty recent so I don't seem to find a good replacement yet.

Anybody know a good way to detect Google Chrome without window.chrome.webstore? Or are we stuck using navigator.userAgent.indexOf("Chrome") !== -1 in the meantime?

Thanks!

like image 373
lalatir Avatar asked Dec 13 '18 13:12

lalatir


People also ask

Can I detect the browser with Javascript?

To detect user browser information we use the navigator. userAgent property. And then we match with the browser name to identify the user browser. Now call this JS function on page load, and this will display the user browser name on page load.

How do I know if someone is using my Google Chrome?

To check if browser is Google Chrome: var isChrome = navigator. userAgent. includes("Chrome") && navigator.

How can you detect the client's browser name in Javascript?

You can use the navigator. appName and navigator. userAgent properties. The userAgent property is more reliable than appName because, for example, Firefox (and some other browsers) may return the string "Netscape" as the value of navigator.

How do I enable touch events in Chrome?

To enable these settings, enter chrome://flags in Chrome's address bar. Then scroll down until you find these two settings: Touch Optimized UI and Enable touch events. Use the drop-down boxes to enable both.


1 Answers

You should try this:

var isChrome = /Google Inc/.test(navigator.vendor);

like image 57
leylek Avatar answered Oct 10 '22 04:10

leylek