const browserRedirect = () => {
let sUserAgent = navigator.userAgent.toLowerCase();
if (/ipad|iphone|midp|rv:1.2.3.4|ucweb|android|windows ce|windows mobile/.test(sUserAgent)) {
//移动端
return 'mobile'
} else {
//pc端
return 'pc'
}
}
判断当前设备是移动端还是PC端
最新推荐文章于 2024-03-28 17:14:00 发布
本文介绍了一个简单的JavaScript函数,用于根据用户代理字符串判断访问者是使用移动端还是PC端设备,并据此返回不同的重定向结果。
3093

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



