用于渲染丰富网页内容的移动设备检测

发布于 2024-11-08 02:55:26 字数 1045 浏览 0 评论 0原文

  1. 迄今为止最具有网络功能的手机是什么(型号和/或用户代理)以及

  2. 在尝试确定他们是否能够处理丰富的移动定制网站时,应评估哪些规则?

我正在开发一个移动网站,目前正在进行一些用户代理检测,以确定移动设备是否应该看到完全增强的 js、jquery mobile、css 视图或普通的后备视图。

这是我目前的两个问题,我想要一些关于如何改进的意见/建议 - 此过滤是从上到下评估的:

增强视图如果用户代理包含以下内容:“iPhone”, “iPad”、“Android 3”、“Android 2”、 “MSIE 9”、“MSIE 8”、“MSIE 7”、“Windows 手机操作系统 7", "IEMobile/7", “BlackBerry99”、“BlackBerry 9800”、 “黑莓平板电脑”

如果用户代理包含以下内容,则后备视图:“Android 1”, “MSIE 6”、“MSIE 5”、“MSIE 4”、“MSIE 3”,然后还有一大堆旧的 黑莓 UA 即“BlackBerry8”和较旧的 Opera Mini 版本即“Opera Mini/3”...

如果发现是网络浏览器,则增强视图(也有助于测试)。这又是由用户代理规则决定的。

然后在 WURFL API 中加载(并找到)用户代理时的后备视图 发现发布日期太旧。 目前我正在考虑这样做 2007 年之前。

当 WURFL device_os 功能显示“Windows Mobile OS”且 device_os_version 功能为“5”或“6”时,后备视图

然后增强视图,因为无法确定他们正在使用什么,因此提供最佳体验(这将迎合新发布的手机)

这种设置方式,最好找到排除设备的理由而不是包含一个,因为最后一个条件将返回增强视图。

  1. What are the most web-capable mobile phones to date (models and / or user agents) and

  2. What rules should be assessed when trying to determine if they will handle a rich mobile-customised site?

I am developing a mobile website and currently doing some user agent detection to determine if the mobile device should see a fully enhanced js, jquery mobile, css view, or plain a fallback one.

Here is what I currently have for my two questions, and I would like some input / suggestions on how this can be improved - this filtering is assessed top-to-bottom:

Enhanced view if the user agent contains the following: "iPhone",
"iPad", "Android 3", "Android 2",
"MSIE 9", "MSIE 8", "MSIE 7", "Windows
Phone OS 7", "IEMobile/7",
"BlackBerry99", "BlackBerry 9800",
"BlackBerry Tablet"

then Fallback view if the user agent contains the following: "Android 1",
"MSIE 6", "MSIE 5", "MSIE 4", "MSIE
3", then there are a whole bunch of old
blackberry UAs i.e. "BlackBerry8" and older Opera Mini
versions i.e. "Opera Mini/3"...

then Enhanced view if found to be a web browser (also helpful for testing reasons). This is again determined by user agent rules.

then Fallback view when the user agent is loaded (and found) in the WURFL API and the
release date is found to be too old.
At the moment I am considering this to
be prior to 2007.

then Fallback view when the WURFL device_os capability shows 'Windows Mobile OS' with device_os_version capability '5', or '6'.

then Enhanced view as could not determine what they are using, so give the best experience (this will cater for new release handsets)

The way this is set up, it is better to find reasons to exclude a device than to include one, as the last condition will return the enhanced view.

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

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

发布评论

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

评论(2

做个ˇ局外人 2024-11-15 02:55:26

最具有网络功能的移动设备是什么
迄今为止的手机(型号和/或用户
代理)

我认为您已经确定了最重要的设备:iOS 设备、Android 2.0+ 和最新的 BlackBerry 设备。但实际上,如果您想知道您的网站的支持程度,您应该检查适用于特定设备的模拟器/模拟器。

可以在此处找到示例用户代理字符串的优秀列表。

什么时候应该评估什么规则
试图确定他们是否会
处理丰富的移动定制网站?

运行 OS 6.0 或更高版本的 BlackBerry 设备将具有基于 WebKit 的浏览器,该浏览器支持最新功能,因此您可以改进对 BlackBerry 设备的过滤,以预测运行良好的新/未发布的设备。以下 User-Agent 示例显示设备正在运行操作系统 6.0.0.141

Mozilla/5.0 (BlackBerry; U; BlackBerry 9800; en) AppleWebKit/534.1+ (KHTML, Like Gecko) Version/6.0.0.141 Mobile Safari/534.1+

在 OS 6.0 之前,BlackBerry User-Agent 看起来有点不同(并且 Web 浏览器体验要差得多)。以下用户代理示例显示设备正在运行操作系统 4.7.1.40

BlackBerry9630/4.7.1.40 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/105

What are the most web-capable mobile
phones to date (models and / or user
agents)

I think you've already identified the most important ones: iOS devices, Android 2.0+, and recent BlackBerry devices. But really, if you want to know how well your site is supported, you should check out the emulators/simulators available for particular devices.

An excellent list of example User-Agent strings can be found here.

What rules should be assessed when
trying to determine if they will
handle a rich mobile customised site?

BlackBerry devices running OS 6.0 or higher will have a WebKit-based browser which supports the latest goodies, so you could improve your filtering for BlackBerry devices to anticipate new/unreleased devices that will work well. The following User-Agent example shows that the device is running OS 6.0.0.141:

Mozilla/5.0 (BlackBerry; U; BlackBerry 9800; en) AppleWebKit/534.1+ (KHTML, Like Gecko) Version/6.0.0.141 Mobile Safari/534.1+

Prior to OS 6.0, the BlackBerry User-Agent looked a bit different (and the web browser experience was much worse). The following User-Agent example shows that the device is running OS 4.7.1.40:

BlackBerry9630/4.7.1.40 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/105
眉目亦如画i 2024-11-15 02:55:26

如果设备支持

来自 WUFL 的preferred_markup = html_web_4_0

If the device supports preferred_markup = html_web_4_0

From WUFL

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