1

I am working on an Apache Wicket WebApplication in Java. In this application I have a general method to detect the user device using the user agent. However, since the iOS 13 update my check is not working anymore for the iPad as the user agent returns MacIntel or Intel Mac for both, iPad and PC. I checked and found that this issue has already been discussed here:
Link 1
Link 2
Link 3
But these solutions are only for JavaScript. I need to handle this in Java (org.apache.wicket.protocol.http.WebSession). In the properties of the WebSession there exist no method for extracting the number of touch points. Can anybody help me getting the number of touch points or has another idea how to solve this issue. Thank you.

My current code looks like this:



    public static boolean isTablet(WebSession pWebSession) {
        String userAgent = pWebSession.getClientInfo().getUserAgent();
        if (userAgent != null && (userAgent.contains("iPad") 
                || (userAgent.contains("Android") && !userAgent.contains("Mobile")))
                || (userAgent.contains("PlayBook"))) {//BlackBerry tablet
            return true;
        }
        return false;
    }

Felix H
  • 155
  • 1
  • 2
  • 10

1 Answers1

2

You can try to use yauaa instead of Wicket internal user Agent which is quite old and therefore has been deprecated in version 8 and it will be removed for 9.

Andrea Del Bene
  • 2,521
  • 1
  • 15
  • 20
  • Hi Andrea, Thank you for the hint. I will look into it. However, this does not totally fix my issue. To apply the fix described in the links of my main text, I need to access the navigator.maxTouchPoints (JS code). This information is not written in the user agent. Do you have any idea how I can get this information? Thanks – Felix H Feb 13 '20 at 09:56
  • If the information you are looking is not in the useragent then analyzing this is useless. It seems like you need information about the browser that is only available in the browser itself. This implicitly leads to the need for client side code (i.e. javascript) to figure out what the browser can do. One of the tools I have come across that may yield what you are looking for is https://modernizr.com/ – Niels Basjes Jul 21 '20 at 07:58