Reputation: 6228
How can I determine which device is running?
My app runs well on Windows, Linux and OSX. but doesn't on CrOS(Chromebook).
So I'd like to sperate code like a..
> if (chrome.systemInfo.platform == CrOS) {
> // code only for CrOs }
Is there anyway to do this way? anyway to get the information of platform?
Upvotes: 0
Views: 127
Reputation: 11038
ChromeOS has the navigator.userAgent
of "CrOS". So the base on the fact, you could have a conditional statement like...:
if (navigator.userAgent.indexOf('CrOS') != -1) {
console.log('ChromeOS');
} else {
console.log('Other platform');
}
Upvotes: 2