How to detect windows phone in client side?

In a widget implementation, how to detect that the browser is windows phone? Is there a convenience method like isIPhone() or isAndroid()

Take a look at this classes:
BrowserInfo - client-side package
WebBrowser - server-side package

or you can do something like that: ( be aware - this is not beautiful :))

if (request instanceof VaadinServletRequest) {
HttpServletRequest httpRequest = ((VaadinServletRequest)request).getHttpServletRequest();
String userAgent = httpRequest.getHeader(“User-Agent”).toLowerCase();
if (userAgent.contains(“ipad”)) { //… }

I tried using BrowserInfo, but is dows not provide the same information as WebBrowser. I was hoping for a more elegant solution.

If I understood correct, you must have something like that :


from this you obtain user-agent data, then some preg-match conditions for detect if is this windows mobile, as ex:

Mozilla/4.0(compatible; MSIE 6.0; Windows NT 5.1; Motorola_ES405B_19103; Windows Phone
we can check for contains Windows Phone [0-7]
(version from 0 to 7), but be carefull some device on windows not contain Windows Phone, but something this - ARM or Touch or WPDesktop or whatever else, maybe this is the reason why check for this OS is not included in standart method