【问题标题】:How can I detect the operating system using GWT?如何使用 GWT 检测操作系统?
【发布时间】:2011-05-21 07:44:27
【问题描述】:

基本上,我想知道我的 GWT 应用程序是否在 MacOS 或任何其他操作系统上运行,以便在 MacOS 上使用 cmdctrl 正确设置快捷方式 其他地方。

【问题讨论】:

    标签: macos gwt operating-system keyboard-shortcuts


    【解决方案1】:

    你可以使用:

    import com.google.gwt.user.client.Window.Navigator;
    ...
    
    String platform = Navigator.getPlatform();
    

    这将返回一个字符串(与 JavaScript 的 navigator.platform 相同)。然后您可以决定类似于this script 的操作系统:它只检查子字符串“Win”/“Mac”/“iPhone”/“Linux”。

    【讨论】:

      猜你喜欢
      • 2012-05-18
      • 2012-04-01
      • 1970-01-01
      • 2015-06-29
      • 2019-10-04
      • 1970-01-01
      • 1970-01-01
      • 2012-02-05
      相关资源
      最近更新 更多