How can I check if a browser is Chromium-based?
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.
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/