在 GWT 中检测移动浏览器 [英] Detecting mobile browser in GWT

查看:25
本文介绍了在 GWT 中检测移动浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为移动设备和 PC 实现一个具有单独用户界面的 Web 应用程序.你知道我如何检测它是否是移动的吗?总的来说,您对在 GWT 中实现此类应用有什么建议吗?

I want to implement a web application with separate user interface for mobile and PC. Do you know how can I detect whether it is mobile or not? In general, do you have any suggestion for implementing such application in GWT?

推荐答案

在客户端,您可以使用Navigator 类来获取平台和用户代理字符串:

On the client side, you can use the Navigator class to get the platform and the user agent string:

Navigator.getPlatform
Navigator.getUserAgent

以这种方式识别设备和平台.

Identify devices and platforms that way.

这篇关于在 GWT 中检测移动浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆