You could retrieve this information in a Java action using ISession.getUserAgent().
This results in a string looking like this: User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko
Hi Enzo,
I think there are different ways to do this (custom java action / JavaScript / JQuery). I have not tried it or read it fully but just found this which I thought might be helpful to you http://stackoverflow.com/questions/21741841/detecting-ios-android-operating-system.
Hope this helps!
Cheers,
Mohammed Siddiqui
You can use JavaScript window.matchMedia() method to detect a mobile device based on the CSS media query.
if (window.matchMedia("(max-width: 767px)").matches)
{
// The viewport is less than 768 pixels wide
document.write("This is a mobile device.");
}
You may also use navigator.userAgentData.mobile .
const isMobile = navigator.userAgentData.mobile;
Another approach would be a responsive media query. You could presume that a mobile phone has a screen size greater than x and less than y. For example:
@media only screen and (min-width: 320px) and (max-width: 600px) {}