js判断浏览器类型及设备(移动页面开发)

(编辑:jimmy 日期: 2024/10/6 浏览:2)

下面主要用javascript代码来判断浏览器类型及设备访问该网页面,支持手机上的所有浏览器,具体代码如下。

<!DOCTYPE html>
<html>
<head>
<title>JS判断是什么设备是什么浏览器-www.jb51.net</title>
<meta charset="utf-8">
<meta name="apple-touch-fullscreen" content="YES" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="format-detection" content="telephone=no"/>

</head>
<body>
<div id="divid">
</div>
<script type="text/javascript">
var os = function() {
var ua = navigator.userAgent,
isQB = /("<br/>";
html[html.length]='是Tablet:'+os.isTablet+"<br/>";
html[html.length]='是Phone:'+os.isPhone+"<br/>";
html[html.length]='是Android:'+os.isAndroid+"<br/>";
html[html.length]='是电脑:'+os.isPc+"<br/>";
html[html.length]='是Opera浏览器:'+os.isOpen+"<br/>";
html[html.length]='是UC浏览器:'+os.isUC+"<br/>";
html[html.length]='是Ipad:'+os.isIpad+"<br/>";
document.getElementById("divid").innerHTML=html.join("");
</script>
</body>
</html>

以上就是javascript代码判断是什么设备是什么浏览器类型(移动页面开发)的全部内容,希望大家喜欢。

一句话新闻

Windows上运行安卓你用过了吗
在去年的5月23日,借助Intel Bridge Technology以及Intel Celadon两项技术的驱动,Intel为PC用户带来了Android On Windows(AOW)平台,并携手国内软件公司腾讯共同推出了腾讯应用宝电脑版,将Windows与安卓两大生态进行了融合,PC的使用体验随即被带入到了一个全新的阶段。