bug: window.Ionic.platforms returns ['mobile', 'mobileweb'] instead of ['desktop'] on chromium based browser
See original GitHub issuePrerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
Ionic Framework Version
- v4.x
- v5.x
- v6.x
- Nightly
Current Behavior
On Chrome desktop browser, I use isPlatform('desktop')
but it always return false and my app always behaves as a mobile one.
Same problem with recent Chromium or Edge browser but no problems on Firefox.
Expected Behavior
isPlatform('desktop')
should return true
on chromium desktop browsers
Steps to Reproduce
- Build an Ionic project
- run it on a chrome browser
- open console and type :
window.Ionic.platforms
You can try it on any Ionic project, like https://www.justwatch.com/ (not mine, just an example)
You will see that this return [‘mobile’, ‘mobileweb’]
Code Reproduction URL
No response
Ionic Info
Ionic:
Ionic CLI : 6.10.1
Utility:
cordova-res : 0.15.1 native-run : 1.0.0
System:
NodeJS : v16.13.2 npm : 8.1.2 OS : Windows 10
Additional Information
When I browse source code here const isMobile = (win: Window) => matchMedia(win, ‘(any-pointer:coarse)’);
I tried window.matchMedia?.('(any-pointer:coarse)').matches
in both Chrome and Firefox: Chrome returns true
, and Firefox false
Maybe it is problem with Chromium ?
Chrome version: 103.0.5060.114 Firefox version: 102.0.1
PS: I checked that I am not in a mobile debug mode before posting this issue 😛
Issue Analytics
- State:
- Created a year ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
Nope, no touch screen, but a waiting Windows Update: I am now on the build 22000.795 (instead of 22000.739) and it works like a charm
Sorry for the waste of time !
Ow… the bug seems to be only on my computer: an other windows 11 PC with same chrome version has no problem…
I’ll be back with more information.