手机检测

发布于 2024-08-28 12:07:00 字数 1436 浏览 9 评论 0原文

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

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

发布评论

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

评论(6

紫竹語嫣☆ 2024-09-04 12:07:00

检查用户代理的价值是最常见的方法,有几个开源解决方案可以为您做到这一点。尝试用谷歌搜索它们。

这是一个例子:
http://detectmobilebrowser.com/

这也是一个有趣的解决方案:
http://mobiforge.com/developing/story/lightweight-device-detection- php

Checking value of user agent is the most common way, there are couple of open source solutions that do that for you.. try Googling for them.

Here is one example:
http://detectmobilebrowser.com/

And here's also one interesting solution:
http://mobiforge.com/developing/story/lightweight-device-detection-php

那伤。 2024-09-04 12:07:00

为此,我可以推荐 WURFL。它是一个 XML 文件,描述了数千种移动设备的功能,并与 .NET、Java、PHP 等可用的 API 相结合,可以根据请求特征(主要是用户代理标头)识别它是哪个设备。

网页有点混乱,急需更新,但数据库和 API 本身非常健全。

I can recommend WURFL for this. It's an XML file describing the capabilities of thousands of mobile devices, and combines with APIs available for .NET, Java, PHP, etc, which can recognise which device it is based on the request characteristics (primarily the user-agent header).

The web page is a bit chaotic and in sore need of an update, but the database and APIs themselves are very sound.

烟织青萝梦 2024-09-04 12:07:00

有一些服务可以为您做到这一点。 http://www.handsetdetection.com/ 可以让这一切变得简单。

There are services that can do this for you. http://www.handsetdetection.com/ is one that makes it easy.

梦过后 2024-09-04 12:07:00

似乎您必须使用用户代理字符串。可以在此处找到一份不错的列表(尽管不一定是最新的)。

Seems like you'd have to use the User Agent string. A decent list (though not necessarily up to date) can be found here.

冰葑 2024-09-04 12:07:00

手机检测需要两个标头参数。

  1. 用户代理 - 用于标识哪个应用程序或系统正在访问另一个系统的字符串。
  2. UAProf - 描述手机功能的 RDF 格式的 URL

请参考这个简单的示例(Restlet):

http://shengchien.blogspot.com/2010/09/restful-mobile-detection.html

There are two header parameters you would need for handset detection.

  1. User agent - a string to identify what application or system is accessing another system.
  2. UAProf - a URL of RDF format which describes handset capabilities

Please refer to this simple example (Restlet):

http://shengchien.blogspot.com/2010/09/restful-mobile-detection.html

巷子口的你 2024-09-04 12:07:00

如果你有 User-Agent,你可以使用以下模块,我正在分享 Python 模块:

  1. https: //github.com/tobie/ua-
    要解析用户代理,您将获得供应商名称和手机(平板电脑/手机)信息。
    您可以将此信息传递给以下模块以获取手机信息。

  2. https://handsetdetection.readme.io/v4/docs
    您需要登录并在登录后从站点获取用户 ID、密钥和站点 ID。其次,创建配置文件(最好是 yaml)并设置属性。现在,您可以按照语法检测并获取设备信息并根据需要使用。
    谢谢。

If you have User-Agent, you can use following modules, I am sharing modules for Python:

  1. https://github.com/tobie/ua-
    To parse the User-Agent, you will get Vendor name and handset (tablets/Mobile phones) information.
    You can pass this information to the following module to get handset info.

  2. https://handsetdetection.readme.io/v4/docs
    You need to login and get user id, secret key and site id from the site after logging in. Secondly, create the config file preferably yaml and set the attributes. Now you can grammatically detect as well as fetch the device info and use as you may.
    Thanks.

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