How does Onsen UI detects the device ?



  • Last night, after the blog post on Meteor + onsen UI 2, I started building an app for fun.

    I was wondering what CLI command I had to call in order to switch from material to IOS design. But I was amazed when I saw it automatically changed when, In chrome debugger, I switched between Iphone 5 simulator or nexus/samsung.

    So, Onsen is not using navigator.device properties no ? How does it detects if it’s running on IOS or Android ?

    So far, I’m having a blast with onsen 2 !


  • Onsen UI

    @MaxenceCornet I’m glad you like it :smile:

    Onsen UI relies on Cordova Plugin Device if present (device.platform). If not, it checks navigator.userAgent. And all of this can be faked with ons.platform.select('android') :sweat_smile:



  • Thank you for your answer !


Log in to reply