判断你的浏览设备: navigator.userAgent.toLowerCase(); (返回当前用户所使用的是什么浏览器,将获得的信息变成小写)

function browserRedirect() {
var _devices= navigator.userAgent.toLowerCase();
var bIsIpad = _devices.match(/ipad/i) == "ipad";
var bIsIphoneOs = _devices.match(/iphone os/i) == "iphone os";
var bIsMidp = _devices.match(/midp/i) == "midp";
var bIsUc7 = _devices.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
var bIsUc = _devices.match(/ucweb/i) == "ucweb";
var bIsAndroid = _devices.match(/android/i) == "android";
var bIsCE = _devices.match(/windows ce/i) == "windows ce";
var bIsWM = _devices.match(/windows mobile/i) == "windows mobile";
document.writeln("您的浏览设备为:");
if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {
// document.writeln("phone");
// 移动设备显示状态
} else {
  // pc设备显示状态
}
}

判断移动端设备: navigator.userAgent.toLowerCase()的更多相关文章

  1. 使用navigator.userAgent.toLowerCase()判断移动端类型

    使用navigator.userAgent.toLowerCase()判断移动端类型 判断设备,区分Android,iphone,ipad和其它 var ua = navigator.userAgen ...

  2. navigator.userAgent.toLowerCase();判断浏览器做兼容

    js简单实例: var ua = navigator.userAgent.toLowerCase(); if (/android/.test(ua)) { $('.date>div>img ...

  3. 如何直接在 PC 端获取其它端设备的 UserAgent 信息呢?

    如何直接在 PC 端获取其它端设备的 UserAgent 信息呢 [博主]反骨仔 [原文地址]http://www.cnblogs.com/liqingwen/p/5909615.html 序 希望收 ...

  4. 使用 navigator.userAgent.toLowerCase() 区别 浏览器 类型

    userAgent 属性是一个只读的字符串,声明了浏览器用于 HTTP 请求的用户代理头的值 var ua = navigator.userAgent.toLowerCase(); 返回的是个字符串 ...

  5. JS判断当前使用设备是pc端还是web端(转MirageFireFox)

    js判断当前设备 最近用bootstrap做自适应,发现仍然很难很好的兼容web端和PC端的现实. 仔细观察百度,淘宝,京东等大型网站,发现这些网站都有对应不同客户端的子站. 站点 PC端url we ...

  6. js 不同浏览器的类型判断 navigator.userAgent

    一.通过navigator.userAgent来进行浏览器类型判断 // 判断浏览器内核.手机系统等,使用 browser.userAgent.mobile var browser = { userA ...

  7. 判断浏览器类型-----------navigator.userAgent.indexOf()

    <script language="JavaScript"> <!-- function getOs() { var OsObject = "" ...

  8. 利用window.navigator.userAgent判断当前是否微信内置浏览器

    <!DOCTYPE HTML> <html lang="en"> <head> <meta charset="utf-8&quo ...

  9. java:JavaScript2:(setTimeout定时器,history.go()前进/后退,navigator.userAgent判断浏览器,location.href,五种方法获取标签属性,setAttribute,innerHTML,三种方法获取form表单信息,JS表单验证,DOM对象,form表单操作)

    1.open,setTimeout,setInterval,clearInterval,clearTimeout <!DOCTYPE> <html> <head> ...

随机推荐

  1. C#入门经典(1)

  2. Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Queries and reconn

    使用MySQL执行update的时候报错:   MySQL     在使用mysql执行update的时候,如果不是用主键当where语句,会报如下错误,使用主键用于where语句中正常. 异常内容: ...

  3. N层架构实现的一个小例子

    主要用到了[单例,抽象工厂,缓存,N层,反射]等知识.架构图如下: 解决方案用到的项目列表如下: 在接口项目中,定义一个IUER接口. namespace IDAL { public interfac ...

  4. Android Guts: Intro to Loopers and Handlers

    One of the reasons I love Android API is because it contains so many useful little things. Many of t ...

  5. 第四弹:overfeat

    overfeat是在AlexNet出现后,推出来的模型,其不仅用于物体分类,来用于定位,检测等,可以说是一个涉及很多应用场景的通用模型,值得看看. 本文将从两个方面来讲解,第一部分从论文角度来说一说, ...

  6. CSS——z-index

    1.特性 ①z-index的值表示谁压着谁.值大的压住值小的. ②只有定位的元素才有z-index 值,也就是说,浮动不可以,相对定位,绝对定位,固定定位都可以. ③z-index值没有单位,是一个正 ...

  7. MemSQL 取代 HDFS 与 Spark 结合,性能大幅提升

    MemSQL 取代 HDFS 与 Spark 结合,性能大幅提升 3,597 次阅读 - 基础架构 Apache Spark是目前非常强大的分布式计算框架.其简单易懂的计算框架使得我们很容易理解.虽然 ...

  8. php解决微信开发中用户昵称中的特殊字符与emoji表情写入mysql错误的问题

    解决办法:将3个字节的特殊字符与emoji表情替换掉即可. $nickname = preg_replace('/xE0[x80-x9F][x80-xBF]'.'|xED[xA0-xBF][x80-x ...

  9. JAVA基础--正则表达式

    .  any character \d  A digit 0-9 \D  a non-digit [^0-9] \s  a whitespace character, 空白字符 \S  a non-w ...

  10. CodeForces 617A Elephant

    C语言语法入门题 #include<cstdio> #include<cstring> #include<vector> #include<cmath> ...