移动设备检测以呈现丰富的Web内容 [英] Mobile device detection for rendering rich web content

查看:76
本文介绍了移动设备检测以呈现丰富的Web内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1. 迄今为止最支持网络的手机(型号和/或用户代理)和

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

在尝试确定它们是否可以处理丰富的移动定制网站时应评估哪些规则?

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

我正在开发一个移动网站,目前正在进行一些用户代理检测,以确定该移动设备是否应看到功能全面增强的js,jquery mobile,css视图或纯后备版本.

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:

增强视图,如果用户代理包含以下内容:"iPhone", "iPad","Android 3","Android 2", "MSIE 9","MSIE 8","MSIE 7","Windows Phone OS 7," IEMobile/7, "BlackBerry99","BlackBerry 9800", "BlackBerry Tablet"

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"

然后 Fallback视图(如果用户代理包含以下内容):"Android 1", "MSIE 6","MSIE 5","MSIE 4","MSIE 3英寸,那么有一堆旧 黑莓UA,例如"BlackBerry8"和较旧的Opera Mini 版本,例如"Opera Mini/3" ...

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.

然后在WURFL API中加载(并找到)用户代理后,再 Fallback视图 发现发布日期过旧. 目前,我正在考虑这样做 在2007年之前.

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.

然后在WURFL device_os功能显示具有device_os_version功能"5"或"6"的"Windows Mobile OS"时, Fallback视图.

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.

推荐答案

最支持网络的手机是什么 迄今为止的手机(型号和/或用户 代理商)

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

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

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?

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

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+

在OS 6.0之前,BlackBerry User-Agent看起来有些不同(并且Web浏览器体验差很多).以下User-Agent示例显示该设备正在运行操作系统 4.7.1.40 :

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

这篇关于移动设备检测以呈现丰富的Web内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆