userAgent判断客户端类型

来源:互联网 发布:在淘宝上做虚拟充值 编辑:程序博客网 时间:2024/06/01 21:49

根据userAgent判断客户端类型


  • 微信判断
function is_weixin(){    var ua = navigator.userAgent.toLowerCase();    if(ua.match(/MicroMessenger/i)=="micromessenger") {        return true;     } else {        return false;    }}
  • 微博判断
if(ua.match(/WeiBo/i) == "weibo")
  • Android客户端
android: ua.indexOf('Android') > -1 || ua.indexOf('android') > -1 || ua.indexOf('Linux') > -1 || ua.indexOf('linux'), //android终端或者uc浏览器
  • iphone&ipad
iPhone: ua.indexOf('iPhone') > -1 || ua.indexOf('iphone') > -1 || ua.indexOf('Mac') > -1 || ua.indexOf('mac') > -1, //是否为iPhone或者QQHD浏览器iPad: ua.indexOf('iPad') > -1 || ua.indexOf('ipad') > -1, //是否iPad

ios移动端页面增加overfow:scroll滑动卡顿现象

解决办法:避免使用overflow:scroll
或者增加: -webkit-overflow-scrolling: touch,据说是启动了硬件加速,所以滑动很流畅,但这个属性会相对耗费更多的内存。

0 0
原创粉丝点击