How to detect Blink in Chrome

4.6k views Asked by At

Is there any way to detect that the user is coming with Blink or Webkit powered Chrome engine? By the way i'm also curious about if i can check somewhere if my browser is with blink or not.

2

There are 2 answers

3
hexalys On BEST ANSWER

Blink is Chrome 28+. So if you are already detecting Chrome via its useragent you could just check: version >= 28 Though not fully reliable if the user agent is spoofed, obviously.

For an additional more reliable way you can check the chrome.notifications API status which became available/stable with Blink/Chrome28+ (on ChromeOS, Windows, and Mac and then Android 4.4)

See this answer for ref, and this documentation for details.

UPDATE: That previous idea was complicated and unreliable. I removed it.

I ran into a feature that was added with Chrome 28 (namely CSS.supports) which is easier and cleaner:

if ((window.chrome || (window.Intl && Intl.v8BreakIterator)) && 'CSS' in window){
//Blink Engine
}

UPDATE 2: Added an extra check because some Blink browsers like Opera Mobile or Maxthon lack the window.chrome object. A v8 feature check is necessary to cover all current Blink engine browsers as of Dec 2014.

And for completeness since you asked for a server side programming language too: On the server side or even for JS eventually, just look for WebKit/537.36. Only a Blink user agent will have that Webkit version. No official Safari version was released with that build number as far as I can tell. However, watch for the IEMobile, Trident or Edge tokens since Windows IE now imitate Android and Blink.

0
Boghyon Hoffmann On

[...] detect that the user is coming with Blink or Webkit powered Chrome engine

In case you'd like to detect a Chromium browser regardless of how its layout engine is called ("Webkit", "Blink", "FutureEngine3000") or how the browser shell is commercially named ("Chrome", "Edge", "Brave", ...), try the User-Agent Client Hints API:

{
  const isChromium = brand => brand.brand === "Chromium";
  console.log(!!globalThis.navigator?.userAgentData?.brands?.some(isChromium));
}

For other properties, see https://user-agent-client-hints.glitch.me/javascript.html.