如何查询WURFL信息

发布于 2024-08-19 15:41:21 字数 29 浏览 2 评论 0原文

wurfl 中查询设备功能的编程接口是什么?

What is the programming interface to querying device capabilities in wurfl?

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

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

发布评论

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

评论(7

吖咩 2024-08-26 15:41:21

WURFL 创建者在这里。 ScientiaMobile 最近推出了一种新方法,使 WURFL 可供开发人员使用。我建议你查看 http://wurfl.io/

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

<script type='text/javascript' src="//wurfl.io/wurfl.js"></script>

您将得到一个如下所示的 JSON 对象:(

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

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

if(WURFL.form_factor == "Tablet"){
    //dostuff();
}

这就是您正在寻找的。

2023 年 5 月编辑:
这是很多年后的事了,但它确实为我原来的答案增加了一个新的维度。 ScientiaMobile 最近推出了一款名为 WURFL Query REST API(简称 QuWURFL)的新产品(其中包括免费版本),它正好解决了这个问题。您不仅可以使用全套 HTTP 标头查询 WURFL,而且现在还可以基于 WURFL 功能及其值创建成熟的查询。

https://docs.scientiamobile。 com/documentation/cloud/getting-started-with-wurfl-wurfl-query-rest-api

您现在可以提出诸如“给我 2010 年至 2020 年间摩托罗拉发布的所有平板电脑”之类的问题。将此服务与上述 WURFL.js 结合使用可能是将设备智能集成到应用程序或面向客户的 Web 应用程序中的好方法。
就像 WURFL.js 一样,QuWURFL 也提供免费版本和高级版本。

免责声明:我为提供此免费服务的公司工作。谢谢。

WURFL Creator here. ScientiaMobile recently launched a new way to make WURFL available to developers. I advise you check out http://wurfl.io/

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

<script type='text/javascript' src="//wurfl.io/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.form_factor == "Tablet"){
    //dostuff();
}

This is what you are looking for.

Edit May 2023:
This comes a lot of years later, but it really adds a new dimension to my original answer. ScientiaMobile recently launched a new product (which includes a free version) called WURFL Query REST API (or QuWURFL for short) that exactly addresses the question. Not only can you query WURFL with a full set of HTTP headers, but you can now also create fully-fledged queries based on WURFL capabilities and their values.

https://docs.scientiamobile.com/documentation/cloud/getting-started-with-wurfl-wurfl-query-rest-api

You can now ask questions like "give me all tablets released by Motorola between 2010 and 2020". Using this service in connection with the aforementioned WURFL.js might be a great way to integrate device intelligence into an app or a customer-facing web application.
Just like WURFL.js, also QuWURFL offers both a free and a premium version.

Disclaimer: I work for the company that offers this free service. Thanks.

逆光下的微笑 2024-08-26 15:41:21

我会推荐用于 PHP 和 Java 的 Tera-WURFL。 MySQL。请访问Tera-WURFL 网站查看。

I would recommend Tera-WURFL for PHP & MySQL. Check it out at the Tera-WURFL Website.

叹倦 2024-08-26 15:41:21

对于 Python,我推荐 pywurfl。您可以在此处了解有关如何使用它的更多信息。

For Python, I recommend pywurfl. You can read more on how to use it here.

千柳 2024-08-26 15:41:21

有适用于 Java、PHP 和 .NET 的 API,所有这些都以相当混乱的方式列在此处。我知道 Java API 非常好,我不知道其他的 API 有多好。

There are APIs for Java, PHP and .NET, all listed in a rather chaotic fashion here. I know the Java API is pretty good, I have no idea how good the others are.

只是在用心讲痛 2024-08-26 15:41:21

取决于您将使用的语言。官方的java、php和.NET api都相当不错。

Depending to the language you will use. The official java,php and .NET api are pretty good.

戏剧牡丹亭 2024-08-26 15:41:21

一个简单的 .NET Wurfl API 示例:

    protected virtual IDevice GetDeviceInfo(string userAgent)
    {
        IWURFLManagerProvider<IWURFLManager> wurflManagerProvider = new WURFLManagerProvider();
        IWURFLManager wurflManager = wurflManagerProvider.WURFLManager;
        return wurflManager.GetDeviceForRequest(userAgent);
    }

更重要的是,一旦您获得了信息,它的可靠性如何以及哪些功能有用

A simple .NET Wurfl api example:

    protected virtual IDevice GetDeviceInfo(string userAgent)
    {
        IWURFLManagerProvider<IWURFLManager> wurflManagerProvider = new WURFLManagerProvider();
        IWURFLManager wurflManager = wurflManagerProvider.WURFLManager;
        return wurflManager.GetDeviceForRequest(userAgent);
    }

More importantly, once you have the info, how reliable is it and what capabilities are useful?

流年里的时光 2024-08-26 15:41:21

对于 .NET,我们一直在此处使用 51 Degrees 解决方案:51 Degrees

请记住,WURFL 许可最近已在如果它适用于您。

For .NET, we've been using the 51degrees solution here: 51 Degrees

Keep in mind that the WURFL licencing has recently changed in case it applies to you.

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