Skip to content

bug: Windows Phone not correctly detected via ionic.Platform.isWindowsPhone() #4070

@PhilHannent

Description

@PhilHannent

Type: bug

Platform: mobile webview

I am working on getting my App ported to the wp8. However when trying to debug a Windows Phone specific issue I tried to use the ionic.Platform.isWindowsPhone() function.

However this returns false, and actually returns true for isAndroid. The Cordova device.platform reports as "android" as well.

Looking at the code:
https://github.com/driftyco/ionic/blob/master/js/utils/platform.js#L247

And the User Agent string the device is reporting:
Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 735) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537

I see the problem. My Lumia 735 is claiming its ALL three devices. Effectively making it useless. Any chances you could make the "Windows Phone" check the first in the list?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions