jerrymice's profilejerrymice的暗黑屋BlogLists Tools Help
    February 15

    关于手机UA适配。。。

    手机User-Agent的自动适配概念,在国内最早应该是出自04年初的深圳讯天和北京吉菲尔,当时移动梦网下做手机铃声最为NEW BEE的两家SP。当时手机铃声规格五花八门,MP3格式还未普及到手机领域,和弦mid还是主流,但原音铃声已经开始崭露头脚。铃声业务最大难点就是手机适配和铃声质量,前者需要人才和技术突破,后者需要艺术家与新技术的结合。通过UA数据判断手机型号、支持的文件等信息,与已有数据对比,自动进行铃声适配。不过现在MP3一统天下,铃声适配也失去了意义。但通过分析手机UA信息、做好适配在客户端下载、手机页面上还是有很大的意义。

         今天与旧同事一起聊起的某客户端适配问题。能够正常取到手机UA,但比较老的NOKIA的机型能适配,比较新的NOKA的机型不能适配。分析了两者的UA 信息,发现较老NOKIA机型信息比较靠前,新的NOKIA的机型,UA中机型信息比较靠后。因为服务器在判定的时候,只判断了UA 中比较靠前的信息,来看nokia两款新旧手机UA的对比
    nokia6681:
    Nokia6681/2.0 (6.32.00) SymbianOS/8.0 Series60/2.6 Profile/MIDP-2.0 Configuration/CLDC-1.1
    nokia5700:
    Mozilla/5.0_(SymbianOS/9.2;_U;_Series60/3.1_Nokia5700/3.29;_Profile/MIDP-2.0_Configuration/CLDC-1.1_)
    解决方法就是读取所有UA 的信息,根据关键字段进行判断自动适配。记得03年非常流行的三菱M320,号称手机上网速度飞快,UA信息开头就是Mitsu/1.3.A (M320)。当时不少SP沿用老的办法,只判断了/之前的型号信息,开始没问题,但随着三菱后续的型号上市,M330、M720、M750一系列的手机都被识别为Mitsu,这一堆后续手机的和弦数、支持哦铃声格式又不同,铃声适配就开始出问题了。
          经过这几年手机UA的变化,手机UA的标准越来越多,信息也越来越复杂。这还不算山寨机的捣乱,山寨机则是完全混乱,有用早就退市的老机器UA的,有随便来个英文字母,有的甚至就是手机系统设计者的随手打的几个字母。不过大部分的手机浏览器在UA 最前面加上了Mozilla。以下是几款比较典型的手机UA部分信息。

    iphone 的safari:
    Mozilla/5.0 (iPhone ; U; CPU like Mac OS X; en) AppleWebKit/420+(KHTML, like Gecko) Version/3.0 Mobile/1C25 Safari/419.3
    nokia6681:
    Nokia6681/2.0 (6.32.00) SymbianOS/8.0 Series60/2.6 Profile/MIDP-2.0 Configuration/CLDC-1.1
    nokia5700:
    Mozilla/5.0_(SymbianOS/9.2;_U;_Series60/3.1_Nokia5700/3.29;_Profile/MIDP-2.0_Configuration/CLDC-1.1_)

    从中可以看出UA包含着及其丰富的信息,对手机客户端、手机页面适配都意义重大。

    Comments

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    Trackbacks

    The trackback URL for this entry is:
    http://jerrymice.spaces.live.com/blog/cns!C72B30FD7EE80E32!4725.trak
    Weblogs that reference this entry
    • None