I have some elements I want to show only if the page is viewed via browser (desktop or mobile browser), but not if viewed from within the app as installed via app store/google play.
This works fine for desktop browsers, however on chrome and the default android browser it acts just like the app - the detected platforms are identical as [‘cordova’, ‘android’, ‘mobile’]
I understand the app itself is a browser, but I was under the impression ‘mobileweb’ would be the difference and it’s not. Any way to properly determine if I’m in a native browser or in the app?
because core only detect if you are using a windows browser opening the application, but if you are using chrome mobile emulation, core will return false, but mobileweb will return true. Therefore you should use the following:
That’s what I’m using, but it’s failing for Chrome on android, and the default android browser. ‘mobileweb’ is not in the platforms array, nor is ‘core’. The platforms array is ‘cordova’, ‘android’, and ‘mobile’ which is the same as the app.
Could you create a minimal repro project of this, upload it to Github and also upload the .apk and host it somewhere so other people can check? I don’t think it should be that way…
Can only be “mobileweb” if there is no “cordova”- which means it isn’T build for platform browser, but copying the content of /www. Does this makes sense?
Ok cool, so that explains the what. I don’t know the platform well enough to know if that’s intended behavior. Given this though, is there a way to differentiate between the app version and a mobile browser?
A related issue - chrome on iOS is returning only ‘core’ as the platform. See screenshot below. Any ideas why or a workaround.
I am trying to determine if the site is running on a desktop vs a mobile device. It works fine on safari and chrome on android. For some reason chrome on iOS returns core.
As a solution, you might want to look at the underlying code and see if you can copy some into your .ts file and make it react to Chrome iOS correctly.