in simulator, behaviour unstable returns: [ios/cordova]

I m trying to detect user OS to do some different things for best UX.
This however I discover that the similator responding stably.

Using iOS simulator, sometimes the following code as ‘ios’, sometimes as ‘cordova’. What can i do to make sure things work stably on device? Or this only happens when I run it on a simualtor, which will totally be fine when i run it on an actual device? still this is confusing.

this.platform.ready().then((x) => {
        this.globalVar.os = 'ios';
     console.log('Platform ready from', x);