Search code examples
javascriptnavigatorchromium-os

How to detect Chromium OS using JavaScript?


I use Windows to develop my app and I use navigator.platform to detect the OS type.

I don't have a Chromium OS so I don't know what the value will be returned by the above script.

Can someone tell me what it returns on Chromium OS?


Solution

  • In the userAgent you will get Chrome and then CrOS

    For example: var ua = window.navigator.userAgent; // Then check if the UA is something like: Mozilla/5.0 (X11; CrOS i686 0.12.433) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.77 Safari/534.30

    Here is a post I've wrote about it in the past: http://greenido.wordpress.com/2011/06/14/how-to-detect-it-is-a-chromebook/