You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

28 lines
978 B

<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script type="text/javascript">
var redirect = () => {
// 获取设备信息
let userAgent = navigator.userAgent.toLowerCase();
// 正则表达式,判断有没有出现这些设备的类型
let device = /ipad|iphone|midp?rv:1.2.3.4|ucweb|android|window ce|window mobile/;
// 判断获取的设备信息与正则表示式的规则有没有匹配的,如果有匹配的,则跳转到移动端,没有就跳转到 PC 端
if (device.test(userAgent)) {
// 跳转到移动端页面
window.location.href = "move.html";
} else {
// 跳转 pc 端页面
window.location.href = "pc.html"
}
}
redirect()
</script>
</html>