gpt4 book ai didi

javascript - 检查黑莓操作系统版本

转载 作者:行者123 更新时间:2023-11-30 10:49:38 24 4
gpt4 key购买 nike

如何在 Webworks 应用程序中通过 javascript 或 jquery 获取黑莓操作系统版本?

我从线程“detect blackberry os version”中尝试了以下代码,但它对我不起作用:

var limit = '4.5.0.127';
var version = /BlackBerry\w+\/([\d\.]+)/i.exec(navigator.userAgent);
if (version[1] && version[1] < limit) {
location.href='notcompatible.cfm';
}

最佳答案

基于这份文件...

http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/How-to-detect-the-BlackBerry-Browser/ta-p/559862

<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 7
Verposition = ua.indexOf("Version/") + 8;
TotLenght = ua.length;
document.write("Jorgesys BB OS Version :: " + ua.substring(Verposition, Verposition + 3));
}
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));
}
}
</script>
  • 一定要启用 Javascript! =)

关于javascript - 检查黑莓操作系统版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6262711/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com