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 !
-
@MaxenceCornet I’m glad you like it :smile:
Onsen UI relies on Cordova Plugin Device if present (
device.platform
). If not, it checksnavigator.userAgent
. And all of this can be faked withons.platform.select('android')
:sweat_smile:
-
Thank you for your answer !