Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I check if a browser is Chromium-based?

I have a Chrome extension, and I am currently writing a website to advertise it. I know that a Chrome extension can be installed in all Chromium-based browsers (Chrome, Opera, etc.).

Is it possible to check if a browser can download the extension from the web store or is chromium-based?

I found code to detect if it was Google Chrome here. Correct me if I'm wrong, but I think window.chrome doesn't return in all Chromium-based browsers.

like image 498
Fredthedoggy Avatar asked Aug 26 '19 14:08

Fredthedoggy


People also ask

What web browsers are based on Chromium?

Microsoft Edge, Samsung Internet, Opera, and many other browsers are based on the Chromium code. Moreover, significant portions of the code are used by several app frameworks.

How do I know if my edge is Chromium?

To check this, launch Microsoft Edge and press the JAWS keystroke INSERT+Q to see what JAWS settings are currently loaded. If you are running JAWS 2020 or later and you receive the message “Microsoft Edge with Chromium settings are loaded,” then you are running the latest version of Edge.

How do you test for Chromium?

The most commonly used methods for chromium detection in water are laboratory-based methods, such as atomic absorption spectroscopy and mass spectroscopy. Although these methods are highly selective and sensitive, they require expensive maintenance and highly trained staff.


2 Answers

window.chrome

As of now, window.chrome works in all chromium based browsers

var isChromium = !!window.chrome;

console.log(isChromium)

Resources

  • https://browserstrangeness.github.io/css_hacks.html
  • http://browserhacks.com/

navigator.userAgentData

User-Agent Client Hints API returns information about the browser and operating system of a user. (Introduced in chrome 90)

var isChromium = !!navigator.userAgentData && navigator.userAgentData.brands.some(data => data.brand == 'Chromium');

console.log(isChromium)

Resources

  • https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgentData
  • https://developer.mozilla.org/en-US/docs/Web/API/NavigatorUAData
  • https://web.dev/migrate-to-ua-ch/
like image 161
User863 Avatar answered Oct 16 '22 08:10

User863


Considering that you just want to get to know whether browser is chromium based or not ,

Method 1: ( Server Side Detection)

-- Get Browser name from client request itself and serving the webpage accordingly. For example, If backend is based on Nodejs, You can get browser name as answered in this answer.

Method 2: ( Client Side Detection)

-- On client Side ,You can first get the Browser Name as answered in this answer , and then check it from HARD-CODED Chromium-based browsers Array.

like image 1
amangupta Avatar answered Oct 16 '22 07:10

amangupta