var redirect = () => {
let userAgent = navigator.userAgent.toLowerCase();
let device = /ipad|iphone|midp|rv:1.2.3.4|ucweb|android|windows ce|windows mobile/;
if(device.test(userAgent)) {
// 跳转移动端页面
window.location.href = 'move.html';
} else {
// 跳转PC端页面
window.location.href = 'pc.html';
}
}
redirect();
也可以根据设备型号、宽度做判断。跳转的逻辑也可以跟细腻一些。

博客提到可依据设备型号、宽度进行判断,且跳转逻辑能更精细,涉及前端开发中对设备的处理和逻辑优化。
1584

被折叠的 条评论
为什么被折叠?



