设备检测
<script type="text/javascript">
	var ua = navigator.userAgent;
	var isMobile = /mobile/i.test(ua);
	var isAndroid = /android/i.test(ua);
	var isiOS = /iPhone|iPad|iPod/i.test(ua);
	var isWechat = /MicroMessenger/i.test(ua);

	if (isMobile) {
		if (isAndroid) {
			window.location.href = 'android.html';
		} else if (isiOS) {
			window.location.href = 'ios.html';
		} else {
			window.location.href = 'mobile.html';
		}
	} else {
		if (isiOS) {
			window.location.href = 'ios.html';
		} else if (isWechat) {
			window.location.href = 'wechat.html';
		} else {
			window.location.href = 'pc.html';
		}
	}
</script>
JavaScript 设备检测:自动跳转到移动端、安卓端、电脑端、苹果端、微信

原文地址: https://www.cveoy.top/t/topic/mF80 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录