Is there anyway to determine the OS of the device running a web deployment ?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Is there anyway to determine the OS of the device running a web deployment ?
I have converted a desktop app to a web app. I'm ecstatic about the results. It runs very well on Win, MacOS, iPhone, iPad, Linux and with all the browsers that I could find. But it doesn't run on Android's browsers. I say it doesn't run, that is not accurate. I have a login stack that accepts user id and password. The password field is hidden and "*"s are displayed as keydown events are used to build the actual password field. It may not be the best way to do this but it works on every other device/os/browser I have tried.
On Android the vertical "cursor" never moves, even though characters are added to the field. The "dummy" field with the "*"s is not visible, but the key strokes are. The keyboard starts acting strangely. Even if I manage to get the correct info into the userid and password fields, for some reason I can get the right information out of the fields to verify the user.
I am using LC fields. If there was a way to determine that the app is on an Android device, I am sure I can solve the problem. But, I don't see a way to get the OS name of the device the browser is running on. Have I missed some function that will return the OS name when deployed to "Web"?
Oh, I have never tried to use the "Android native field". What happens if you're not on an Android device if you use the Android Native Field?
You might have guessed that I'm not an Android guy.
Thanks for any help,
David Kesler
On Android the vertical "cursor" never moves, even though characters are added to the field. The "dummy" field with the "*"s is not visible, but the key strokes are. The keyboard starts acting strangely. Even if I manage to get the correct info into the userid and password fields, for some reason I can get the right information out of the fields to verify the user.
I am using LC fields. If there was a way to determine that the app is on an Android device, I am sure I can solve the problem. But, I don't see a way to get the OS name of the device the browser is running on. Have I missed some function that will return the OS name when deployed to "Web"?
Oh, I have never tried to use the "Android native field". What happens if you're not on an Android device if you use the Android Native Field?
You might have guessed that I'm not an Android guy.
Thanks for any help,
David Kesler
-
- VIP Livecode Opensource Backer
- Posts: 6649
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Is there anyway to determine the OS of the device running a web deployment ?
Nothing, it doesn't work. But in this case I don't think it's needed anyway since you're building for a browser and those don't use native OS fields. It's all HTML. The default browser on Android is Chrome so I'd think it should work as it does on Chrome for desktop. Firefox is available on Android, you could try installing it from the Play Store and see if it behaves differently.Oh, I have never tried to use the "Android native field". What happens if you're not on an Android device if you use the Android Native Field?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Is there anyway to determine the OS of the device running a web deployment ?
It works on Chrome on Win10 and macOS. But not on any Android device that it has been tested on(3 Samsung phones, 2 Samsung tables, and a Pixel phone.)
I’ll try Firefox.
After I posted the question on the Android Native Field, I realized that it really was not a possibility that that would work.
Once I isolate the exact cause of the failure, at least at the LC level, I’ll post my findings and report a bug if one is loose.
Thanks,
David Kesler
I’ll try Firefox.
After I posted the question on the Android Native Field, I realized that it really was not a possibility that that would work.
Once I isolate the exact cause of the failure, at least at the LC level, I’ll post my findings and report a bug if one is loose.
Thanks,
David Kesler
Re: Is there anyway to determine the OS of the device running a web deployment ?
I have been playing with a stack to answer the question of determining the OS of the device that requests a web app.
My stack may be a solution to the question. It asks the server to return the Browser's User Agent (a string sent by the device to the server).
The default User Agent string provided by the device usually contains a reference to the browser and an indication of the hardware.
Here are the strings from my Apple Macintosh laptop, my iPhone and my iPad:
Laptop:
In all three cases, the Safari browser is correctly identified near at the end of the strings.
Feel free to try out my stack at:
https://bobcole.on-rev.com/PlatformWeb/PlatformWeb.html
I'll leave the web app on my server for a while but I might remove it some time in the future.
I don't have any way to run this web app on Windows or Linux so other I'll have to leave it up to others to respond with their results.
It will be interesting to see if Android devices can be identified.
The stack is fairly simple (below).
Enjoy,
Bob
LiveCode 10.0.0-dp-3
MacOS 12.5 (Monterey)
MacBook Pro (Chip: Apple M1 Max)
Notes:
When using this stack in the IDE, the User Agent string may appear differently. For example, on my laptop, the string appears as: LiveCode (MacOS)
The stack does not work in a browser window when deployed with the Test menu or Test button in LC 10.0.0-dp-3 on my Mac laptop.
The stack does work after saving as a standalone app and moving it to a LiveCode enabled web server like on-rev.com (link above)
My stack may be a solution to the question. It asks the server to return the Browser's User Agent (a string sent by the device to the server).
The default User Agent string provided by the device usually contains a reference to the browser and an indication of the hardware.
Here are the strings from my Apple Macintosh laptop, my iPhone and my iPad:
Laptop:
iPhone:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6 Safari/605.1.15
iPad:Mozilla/5.0 (iPhone; CPU iPhone OS 15_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6 Mobile/15E148 Safari/604.1
I am surprised to see the Laptop and iPad report nearly the same User Agent string. The iPhone is clearly identified as distinct.Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6 Safari/605.1.15
In all three cases, the Safari browser is correctly identified near at the end of the strings.
Feel free to try out my stack at:
https://bobcole.on-rev.com/PlatformWeb/PlatformWeb.html
I'll leave the web app on my server for a while but I might remove it some time in the future.
I don't have any way to run this web app on Windows or Linux so other I'll have to leave it up to others to respond with their results.
It will be interesting to see if Android devices can be identified.
The stack is fairly simple (below).
Enjoy,
Bob
LiveCode 10.0.0-dp-3
MacOS 12.5 (Monterey)
MacBook Pro (Chip: Apple M1 Max)
Notes:
When using this stack in the IDE, the User Agent string may appear differently. For example, on my laptop, the string appears as: LiveCode (MacOS)
The stack does not work in a browser window when deployed with the Test menu or Test button in LC 10.0.0-dp-3 on my Mac laptop.
The stack does work after saving as a standalone app and moving it to a LiveCode enabled web server like on-rev.com (link above)
-
- Livecode Opensource Backer
- Posts: 7586
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Is there anyway to determine the OS of the device running a web deployment ?
Hey-Ho, and Hello from my Samsung Galaxy:
Mozilla/5.0 (Linux; Android 11) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Mobile Safari/537.36
This strikes me as a bit odd as I viewed your web app in the Brave browser.
What is clear is 'Android' . . . congratulations, this DOES detect Android phones.
Mozilla/5.0 (Linux; Android 11) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Mobile Safari/537.36
This strikes me as a bit odd as I viewed your web app in the Brave browser.
What is clear is 'Android' . . . congratulations, this DOES detect Android phones.
Last edited by richmond62 on Wed Aug 03, 2022 11:14 am, edited 1 time in total.
-
- VIP Livecode Opensource Backer
- Posts: 9218
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Is there anyway to determine the OS of the device running a web deployment ?
How?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Is there anyway to determine the OS of the device running a web deployment ?
Thank you bobcole for giving my problem some thought and effort, I really appreciate it. Sooner or later others will need the strategy that you used to get the information.
Thanks to richmond62 for going to the trouble of verifying the Android response.
My plan is to use answer and password dialogs instead of normal fields. Hopefully it will work.
Thanks again to everyone.
David Kesler
Thanks to richmond62 for going to the trouble of verifying the Android response.
My plan is to use answer and password dialogs instead of normal fields. Hopefully it will work.
Thanks again to everyone.
David Kesler
-
- Livecode Opensource Backer
- Posts: 7586
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Is there anyway to determine the OS of the device running a web deployment ?
And, as I am at present fooling around with a laptop running Xubuntu 22.04:
Mozilla/5.0 (X11; Linux x86_64; rv:103.0) Gecko/20100101 Firefox/103.0
Mozilla/5.0 (X11; Linux x86_64; rv:103.0) Gecko/20100101 Firefox/103.0
-
- Posts: 556
- Joined: Wed Apr 24, 2013 4:53 pm
- Contact:
Re: Is there anyway to determine the OS of the device running a web deployment ?
Code: Select all
do "result = navigator.platform;" as javaScript
answer the result
Similarly 'the processor' returns 'js' instead of more useful info such as the actual CPU type the web app is running on.
But you can get lots of that sort of info from the outer web page APIs using do tJS as javaSCript and then checking 'the result'
Code: Select all
do "result = window.navigator.userAgent;" as javaScript
answer the result