'How to detect Blink in Chrome

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.



Solution 1:[1]

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.

Solution 2:[2]

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

I guess the question is looking for a solution to detect "Chromium" browser regardless how its engine is called ("Webkit", "Blink", "FutureEngine3000") or how the browser is commercially called ("Chrome", "Edge", "Brave"*, ...).

In that case, 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.


* Some browsers explicitly hide navigator.userAgentData from being read. See e.g. Brave PR 11932.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Community
Solution 2 Boghyon Hoffmann