手机识别:
1 2 3 4 5 | var isAndroid = navigator.appVersion.toLowerCase().indexOf( 'android' ) >= 0, isIphone = navigator.appVersion.toLowerCase().indexOf( 'iphone' ) >= 0; if (isAndroid) { window.location.href = "XXX.html" ; } |
$().ready(function(){
alert("00000");
var s = navigator.userAgent;
if (s.indexOf("Android") >= 0 && s.indexOf("MicroMessenger") >= 0) {
alert("1111111110");
$("#xxx").show();//提示按钮
$("#upphoto").hide();//上传按钮
}else{
$("#xxx").hide();
alert("2222");
}
$("#xxx").click(function(){
$("#sharebox").toggle();
$("#sharebox").css({ "top": $(window).scrollTop() })
})
})
</script>
<style>
#sharebox{position: absolute; z-index: 1000000; right: 0; width: 100%; text-align: right;display:none; background:rgba(0,0,0,0.5)}
#sharebox img{width:100%}
</style>
</head>
<body>
<div id="sharebox">
<img src="file:///C|/Users/xiamu/Documents/Public/css/follow2.png" />
</div>
<div id="xxx">1111111</div>
<div id="upphoto">22222222</div>
</body>
/判断非微信浏览器
$().ready(function(e) {
var ua = navigator.userAgent.toLowerCase();
if(ua.match(/MicroMessenger/i)=="micromessenger") {
return true;
} else {
window.location.href='http://www.tuotuo.im/mobiles/index';
}
});
//判断安卓ios的访问
function wyj(a,b){
var ua = (navigator.userAgent || navigator.vendor || window.opera);
var uaName = ua.toLowerCase();
if (/android/i.test(uaName)) {
wyj1(a,b);
}else if(/ip(hone|od)/i.test(uaName)){
wyj2(a,b);
}else{
return;
}
}