首页 > 移动平台 > 详细

JS 判断手机端和pc端后跳转对应页面

时间:2015-11-10 02:10:54      阅读:417      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>判断手机端和pc端</title>
<script type="text/javascript" src="jquery-1.10.1.min.js"></script>
<script type="text/javascript">
<!--判断手机端和pc端-->
(function () {
	var sUserAgent = navigator.userAgent;
	if (sUserAgent.indexOf(‘Android‘) > -1 || sUserAgent.indexOf(‘iPhone‘) > -1 || sUserAgent.indexOf(‘iPad‘) > -1 || sUserAgent.indexOf(‘iPod‘) > -1 || sUserAgent.indexOf(‘Symbian‘) > -1) {
		location.href = ‘http://m.onestopweb.cn/‘;            
	} else {
		//location.href = ‘http://www.onestopweb.cn/‘;  
    }        
})(); 
</script>
</head>
<body>
<h3>阅谁问君诵,水落清香浮。</h3>
</body>
</html>

?

效果图:
bubuko.com,布布扣
?

?

?

JS 判断手机端和pc端后跳转对应页面

原文:http://onestopweb.iteye.com/blog/2255636

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!