如何用JavaScript判断黑莓手机的型号,版本?

来源:互联网 发布:男士真皮背包 知乎 编辑:程序博客网 时间:2024/05/17 04:10

黑莓手机浏览器直接访问这个网页(web url)即可。



<script type="text/javascript">    var ua = navigator.userAgent;    if (ua.indexOf("BlackBerry") >= 0) {        if (ua.indexOf("Version/") >= 0) { // ***User Agent in BlackBerry 6 and BlackBerry 7position = ua.indexOf("BlackBerry ") + 11;document.write("BlackBerry Model : " + ua.substring(position, position + 4) + "<br/>");            position = ua.indexOf("Version/") + 8;            document.write("BlackBerry OS Version : " +  ua.substring(position, position + 10) + "<br/>");position = ua.indexOf("Version/") + 8 + 6;bundle =  ua.substring(position, position + 3 );document.write("BlackBerry OS Version : " +  bundle + "<br/>");if (bundle < 649) document.write("WARNING: please contact IT to upgrade BlackBerry OS. Otherwise you may experience international roam problem when you go abroad.");else     document.write("Thank you, your device need no upgrade.");        }        else {// ***User Agent in BlackBerry Device Software 4.2 to 5.0            var SplitUA = ua.split("/");//document.write("Jorgesys BB OS Version :: " + SplitUA[1].substring(0, 3));document.write("You device is OS 4.2 - 5.0. " + ua);        }    }</script>


原创粉丝点击