整理查询一下,js判断手机浏览器的方法

<script type="text/javascript">
/*
* 智能机浏览器版本信息:包括微信内置
*
*/
var browser={
versions:function(){
var u = navigator.userAgent, app = navigator.appVersion;
return {//移动终端浏览器版本信息
trident: u.indexOf('Trident') > -, //IE内核
presto: u.indexOf('Presto') > -, //opera内核
webKit: u.indexOf('AppleWebKit') > -, //苹果、谷歌内核
gecko: u.indexOf('Gecko') > - && u.indexOf('KHTML') == -, //火狐内核
mobile: !!u.match(/AppleWebKit.*Mobile.*/)||!!u.match(/AppleWebKit/), //是否为移动终端
ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
android: u.indexOf('Android') > - || u.indexOf('Linux') > -, //android终端或者uc浏览器
iPhone: u.indexOf('iPhone') > - || u.indexOf('Mac') > -, //是否为iPhone或者QQHD浏览器
iPad: u.indexOf('iPad') > -, //是否iPad
wxin: u.indexOf('MicroMessenger') > -, //判断是不是微信内置浏览器打开
webApp: u.indexOf('Safari') == - //是否web应该程序,没有头部与底部
};
}(),
language:(navigator.browserLanguage || navigator.language).toLowerCase()
}
document.writeln("语言版本: "+browser.language);
document.writeln(" 是否为移动终端: "+browser.versions.mobile);
document.writeln(" ios终端: "+browser.versions.ios);
document.writeln(" android终端: "+browser.versions.android);
document.writeln(" 是否为iPhone: "+browser.versions.iPhone);
document.writeln(" 是否iPad: "+browser.versions.iPad);
document.writeln(" 是否微信打开: "+browser.versions.wxin);
document.writeln(navigator.userAgent); </script>

参考地址:

http://www.cnblogs.com/yuzhongwusan/archive/2012/09/03/2669022.html

JS手机浏览器判断(转)的更多相关文章

  1. js的浏览器判断方法

    使用navigator.userAgent来判断浏览器类型. 1.浏览器版本号函数: var br=navigator.userAgent.toLowerCase();   var browserVe ...

  2. js手机浏览器浏览WebApp弹出的键盘遮盖住文本框的解决办法

    if(window.navigator.userAgent.indexOf('Android') > -1 || window.navigator.userAgent.indexOf('Adr' ...

  3. js手机浏览器video标签会一直置顶,遮盖住弹出层问题

    <video x5-playsinline="" playsinline="" webkit-playsinline="">&l ...

  4. js判断是否为手机浏览器

    JS判断手机浏览器 判断原理: JavaScript是前端开发的主要语言,我们可以通过 编写JavaScript程序来判断浏览器的类型及版本.JavaScript判断浏览器类型一般有两种办法,一种是根 ...

  5. 识别手机浏览器代码【C#和JS两种语言】

    C# 识别手机浏览器代码: public static bool MobileBrowserDetect() { bool bismobile = false; try { #region 包含and ...

  6. js、php 判断用户终端 、浏览器类型

    js 判断 用户使用终端 function isMobeil() { if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iP ...

  7. 3种方法判断手机浏览器跳转WAP手机网站

    随着移动设备的普及,企业的网络宣传已经不能局限在PC端,而需要同时在移动端有所建树.对于公司网站来说,以前都是做的PC端的,当然手机等移动端也可以访问,但是用户体验肯定不如完全适合的手机端来的方便.我 ...

  8. 把cookie以json形式返回,用js来set cookie.(解决手机浏览器未知情况下获取不到cookie)

    .继上一篇随笔,链接点我,解决手机端cookie的问题. .上次用cookie+redis实现了session,并且手机浏览器可能回传cookies有问题,所以最后用js取出cookie跟在请求的ur ...

  9. 通过userAgent判断手机浏览器类型

    我们可以通过userAgent来判断,比如检测某些关键字,例如:AppleWebKit*****Mobile或AppleWebKit,需要注意的是有些浏览器的userAgent中并不包含AppleWe ...

随机推荐

  1. OpenGL基础图形的绘制

    例一:绘制五角星 设五角星5个顶点分别为ABCDE,顶点到坐标轴原点距离为r,ABCDE各点用r表示,分别为 A(0,r); B(-r*sin(2/5*Pi),r*cos(2/5*Pi)); C(-r ...

  2. Python学习笔记一

    原来Python的文件配置好环境变量直接双击就可以运行,当然也可以控制台+编辑器 first try: import turtle window=turtle.Screen() babbage=tur ...

  3. dp水题 序列问题 (9道)

    9道题.A了8道,A题看题解也没弄懂怎么维护m段子序列的,过一段时间再回来看看     dp试水 47:56:23 125:00:00   Overview Problem Status Rank ( ...

  4. linux 命令free -m 命令结果分析

    free -m 命令详解 free -m 分析系统内存使用情况:

  5. 9.5---所有字符串的排列组合(CC150)

    1,这个是自己写的.一直LTE. public static ArrayList<String> getPerms(String str) { if (str == null) { ret ...

  6. 4.7---最近公共祖先(CC150)

    import java.util.*; public class LCA { public static int getLCA(int a, int b){ if(a < 1 || b < ...

  7. C# nullable<T> 用法小结

    今天在园子里看到一个关于C#中对于可空类型的描述的帖子,感觉不错于是自己写了个小例子尝试下. 在C#中,对于可空类型描述为:Nullable<T>, 它表示该类型是可以为空的一个类型.它被 ...

  8. Fraction to Recurring Decimal

    Given two integers representing the numerator and denominator of a fraction, return the fraction in ...

  9. jenkins结合ansible用shell实现自动化部署和回滚

    最近用jenkins+gitlab+ansible做持续化集成,自动化部署和版本回滚.然而deploy plugin没能做到增量升级和回滚操作,折腾了很久决定自己写个脚本来简单实现. 环境: cent ...

  10. ios 使用autolayout 后button 的frame 无法设置问题!

    问题见这里,只能通过bounds和center进行设置!http://www.cocoachina.com/bbs/read.php?tid-236862.html 待研究!!!!~~~