4

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.

Artjom B.
  • 61,146
  • 24
  • 125
  • 222
wintercounter
  • 7,500
  • 6
  • 32
  • 46
  • 1
    Where do you want to check this? Javascript or a server side programming language. – Seb Dec 18 '13 at 10:26

2 Answers2

7

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.

Community
  • 1
  • 1
hexalys
  • 5,177
  • 3
  • 31
  • 56
  • So, would the '537.36' be a reliable check for Blink, now, for Chromium and Opera as well? – Shahar 'Dawn' Or May 21 '14 at 10:36
  • 1
    @ShaharOr If the userAgent is not spoofed, yes. The only potential false positive case you could see from a *legit* user, is if they use Desktop Mode on a Mobile device which might spoof a Blink Agent. – hexalys May 21 '14 at 10:52
  • 1
    @ShaharOr FYI, just tested it - testing for `window.CSS` applies to Opera with Blink as well :) – pilau May 25 '14 at 08:00
0

[...] 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.

Boghyon Hoffmann
  • 17,103
  • 12
  • 72
  • 170