标签: platform-detection

检测移动浏览器

我正在寻找一个函数,如果用户有移动浏览器,则返回布尔值.

我知道我可以使用navigator.userAgent正则表达式来使用和编写该函数,但是用户代理对于不同的平台来说太多了.我怀疑匹配所有可能的设备会很容易,我认为这个问题已经解决了很多次,所以应该有一些完整的解决方案来完成这样的任务.

我正在看这个网站,但遗憾的是脚本是如此神秘,以至于我不知道如何将它用于我的目的,即创建一个返回true/false的函数.

javascript browser-detection mobile-browser platform-detection

808
推荐指数
19
解决办法
92万
查看次数

如何使用.NET检测Windows 64位平台?

.NET 2.0 C#应用程序中,我使用以下代码来检测操作系统平台:

string os_platform = System.Environment.OSVersion.Platform.ToString();
Run Code Online (Sandbox Code Playgroud)

这将返回"Win32NT".问题是,即使在Windows Vista 64位上运行,它也会返回"Win32NT".

有没有其他方法可以知道正确的平台(32或64位)?

请注意,在Windows 64位上作为32位应用程序运行时,它还应检测64位.

c# windows 64-bit .net-2.0 platform-detection

258
推荐指数
14
解决办法
19万
查看次数

检测Windows还是Linux?

我正在寻求在Windows和Linux中运行一个通用的Java程序.

该程序需要在每个平台上做一些不同的事情.

那么我的Java程序如何检测它是否应该在Linux与Windows之间运行?

java linux windows platform-detection

123
推荐指数
5
解决办法
10万
查看次数

可靠地在Python中检测Windows

我正在研究几种Linux工具,需要阻止在Windows上安装,因为它依赖于FHS,因此在该平台上变得无用.该platform.platform功能接近,但只返回一个字符串.

不幸的是,我不知道在该字符串中搜索什么以获得可靠的结果.有谁知道要搜索什么,或者有人知道我在这里缺少的另一个功能吗?

python windows platform-detection

52
推荐指数
5
解决办法
3万
查看次数

通过groovy/grails检测平台(Window或Linux)

有没有办法检测Groovy/Grails运行网站的平台(Window/Linux)?

grails groovy platform-detection

30
推荐指数
1
解决办法
1万
查看次数

使用CSS检测不同的设备平台

我想说我已阅读并尝试了许多说明的变体:

我想让我的页面使用不同的CSS文件,具体取决于所使用的设备.我已经看到了许多解决方案,都使用了上面的某种形式.

然而,当在HTC Desire上进行测试时,我始终获得用于iPad的输出或完全未经过滤的输出.目前,我的测试代码基于:

http://www.cloudfour.com/ipad-css/
Run Code Online (Sandbox Code Playgroud)

这是我的HTML文件:

<html>
<head>
    <title>orientation and device detection in css3</title>

    <link rel="stylesheet" media="all and (max-device-width: 480px) and (orientation:landscape)" href="iphone-landscape.css" />
    <link rel="stylesheet" media="all and (max-device-width: 480px) and (orientation:portrait)" href="iphone-portrait.css" />

    <link rel="stylesheet" media="all and (device-width: 768px) and (device-height: 1024px) and (orientation:landscape)" href="ipad-landscape.css" />
    <link rel="stylesheet" media="all and (device-width: 768px) and (device-height: 1024px) and (orientation:portrait)" href="ipad-portrait.css" />

    <link rel="stylesheet" media="all and (device-width: 480px) and (device-height: 800px) and (orientation:landscape)" href="htcdesire-landscape.css" /> …
Run Code Online (Sandbox Code Playgroud)

css mobile-devices platform-detection

14
推荐指数
1
解决办法
2万
查看次数

如何在powershell中检测Linux或macOS或Windows?

uname -s在 bash 脚本中使用来确定操作系统,当它在 Linux、macOS 或 Windows 上运行时,它会返回 Linux、Darwin 或 MINGW64_NT...。

EDIT0 :我希望我的$PROFILE脚本能够检测操作系统是否在带有 PS 的 Windows(版本可能低于 6)或带有 PSv>=6 的 Linux 上运行。

我在 powershell 中找到了这个:

PS> [System.Environment]::OSVersion.Platform
Run Code Online (Sandbox Code Playgroud)

在 Linux 上,它返回Unix,在 64 位 Windows 上,它返回Win32NT.

我没有可用的 macOS(还没有:)),所以我不知道它在 macOS 上实际返回什么。

UnixEDIT1:此方法在 Windows32b 和 Windows64b之间似乎没有区别Linux

还有哪些其他方法可以检测 powershell 5.1 中的操作系统?

powershell uname platform-detection

3
推荐指数
1
解决办法
5436
查看次数