2

I am making a chrome app and I would like to know the operating system that the app is being run on so I can display a different style for the operating system. It would be preferable if there is a chrome api I could use but I highly doubt that there is such a thing for determining the operating system. So how could I tell the operating system from a chrome app?

My app would not work with the instructions for the extension as app's have different api's and different restrictions than chrome extensions.

dragonloverlord
  • 432
  • 5
  • 21
  • 1
    http://stackoverflow.com/a/9514476/1365365 – Jamie H Nov 05 '14 at 16:01
  • 1
    @JamieH there's a better Chrome API specific answer. – Xan Nov 05 '14 at 16:01
  • _"My app would not work with the instructions for the extension..."_ You are mistaken. Some APIs are shared between extensions and apps. This one in particular is [available for apps](https://developer.chrome.com/apps/runtime#method-getPlatformInfo); I wouldn't mark it as duplicate otherwise. – Xan Nov 05 '14 at 16:14

1 Answers1

1

Use the getPlatformInfo in chrome's api. Like this:

chrome.runtime.getPlatformInfo(function(info) {
    // Display host OS in the console
    console.log(info.os);
});

Is that what you need?

Drazzah
  • 7,029
  • 6
  • 29
  • 56