JS PC端扫二维码跳转到手机端

if (/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))) {
	if (window.location.href.indexOf("?mobile") < 0) {
		try {
			if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
				window.location.href = "http://www.onestopweb.cn/";
			}
		} catch (e) {}
	}
}

 

<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<title></title>
<script src="js/mobile.js"></script>
</head>
<body>
<p>阅谁问君诵,水落清香浮。</p>
</body>
</html>

 

效果图:
JS PC端扫二维码跳转到手机端_第1张图片
 

 

 

你可能感兴趣的:(js,判断,PC端扫二维码跳转到手机端)