1 $(window).on("load",function(){ 2 var winHeight = $(window).height(); 3 function is_weixin() { 4 var ua = navigator.userAgent.toLowerCase(); //获取用户端信息 5 6 if (ua.match(/MicroMessenger/i) == "micromessenger") { 7 return true; 8 } else { 9 return false; 10 } 11 } 12 var isWeixin = is_weixin(); 13 if(isWeixin){ 14 $(".weixin-tip").css("height",winHeight); 15 $(".weixin-tip").show(); 16 } 17 })
1 // 匹配其他浏览器 2 var info = { 3 ie: /msie/.test(ua) && !/opera/.test(ua), //匹配IE浏览器 4 op: /opera/.test(ua), //匹配Opera浏览器 5 sa: /version.*safari/.test(ua), //匹配Safari浏览器 6 ch: /chrome/.test(ua), //匹配Chrome浏览器 7 ff: /gecko/.test(ua) && !/webkit/.test(ua) //匹配Firefox浏览器 8 };
// window.navigator.userAgent 可以获取浏览器相关信息
浙公网安备 33010602011771号