如何使用 Wurfl 检测所有 iOS 设备?

发布于 2024-12-31 22:28:51 字数 1437 浏览 0 评论 0 原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

南冥有猫 2025-01-07 22:28:51

这里是 CTO @ScientiaMobile 和 WURFL 创建者。我建议你查看 http://wurfljs.com/

简而言之,如果你导入一个小 JS 文件

<script type='text/javascript' src="http://wurfljs.com/wurfl.js"></script>

:将留下一个如下所示的 JSON 对象:(

{
 "complete_device_name":"Google Nexus 7",
 "is_mobile":true,
 "form_factor":"Tablet"
}

当然,假设您使用的是 Nexus 7),您将能够执行以下操作:

if(WURFL.is_mobile){
    //dostuff();
}

重要的是,我们会竭尽全力识别 iPhone 的实际型号通过利用 javascript(这允许我们利用无法通过纯粹分析 HTTP 标头获得的信息)

请注意,我为提供此免费服务的公司工作。谢谢。

CTO @ScientiaMobile and WURFL creator here. I advise you check out http://wurfljs.com/

In a nutshell, if you import a tiny JS file:

<script type='text/javascript' src="http://wurfljs.com/wurfl.js"></script>

you will be left with a JSON object that looks like:

{
 "complete_device_name":"Google Nexus 7",
 "is_mobile":true,
 "form_factor":"Tablet"
}

(that's assuming you are using a Nexus 7, of course) and you will be able to do things like:

if(WURFL.is_mobile){
    //dostuff();
}

As an important aside, we go out of our way to recognize iPhone actual models by exploiting javascript (this allows us to exploit info that is not available through sheer analysis of the HTTP headers)

Please note that I work for the company that offers this free service. Thanks.

坦然微笑 2025-01-07 22:28:51

可以通过检查设备操作系统功能来识别 iOS 设备:

假设您已经设置了 WURFL 管理器:

$device = $wurflManager->getDeviceForUserAgent($_SERVER["HTTP_USER_AGENT"]);

if ($device->getCapability("device_os") == "iPhone OS") {
   // device is an iPhone or iPod
}

iOS devices can be identified by checking the device OS capability:

Assuming you've setup a WURFL manager already:

$device = $wurflManager->getDeviceForUserAgent($_SERVER["HTTP_USER_AGENT"]);

if ($device->getCapability("device_os") == "iPhone OS") {
   // device is an iPhone or iPod
}
天涯离梦残月幽梦 2025-01-07 22:28:51

作为替代答案,您可能需要考虑 51Degrees.mobi。请参阅此博客文章用于 PHP 集成,尽管它将涉及同时运行 IIS .NET 服务。

As an alternative answer you might want to consider 51Degrees.mobi. See this blog post for PHP integration, although it will involve running an IIS .NET services alongside.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文