js判断手机访问PC端跳转到手机站


<script type="text/javascript">
(function() {

//得到域名后缀
var path = location.pathname.split('/')
path = path.pop();

var ua = navigator.userAgent.toLowerCase();
var bIsIpad = ua.match(/ipad/i) == "ipad";
var bIsIphoneOs = ua.match(/iphone os/i) == "iphone os";
var bIsAndroid = ua.match(/android/i) == "android";
var bIsWM = ua.match(/windows mobile/i) == "windows mobile";
if (bIsIphoneOs || bIsAndroid || bIsWM) {
window.location.href = "http://m.51jinsha.net/"+path;   //跳转到二级页面
}
})();
</script>


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM