判断如果是移动设备则打开另一链接

Posted 小星星的star

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了判断如果是移动设备则打开另一链接相关的知识,希望对你有一定的参考价值。

var userAgentInfo = navigator.userAgent;
    if  (userAgentInfo.indexOf("android") > 0 || userAgentInfo.indexOf("iPhone") > 0 || userAgentInfo.indexOf("SymbianOS") > 0 || userAgentInfo.indexOf("Windows Phone") > 0 || userAgentInfo.indexOf("iPod") > 0 || userAgentInfo.indexOf("iPad") > 0)
    {
        window.location.href = "/wap/index.html";
    }else {
        }

 

以上是关于判断如果是移动设备则打开另一链接的主要内容,如果未能解决你的问题,请参考以下文章