通过js语句判断web网站的访问端是电脑还是手机

2025-05-05 13:08:17
推荐回答(1个)
回答1:


try{
    if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
        window.location.href="index1.asp";
    }else{
        window.location.href="index2.asp";
    }
}catch(e){}