• pc/shouji/weixin判断跳转


    pc 和 手机端 判断

    function IsPC() {
    var userAgentInfo = navigator.userAgent;
    var Agents = ["Android", "iPhone",
    "SymbianOS", "Windows Phone",
    "iPad", "iPod"];
    var flag = true;
    for (var v = 0; v < Agents.length; v++) {
    if (userAgentInfo.indexOf(Agents[v]) > 0) {
    flag = false;
    break;
    }
    }
    return flag;
    }
    function Is_weixn(){
    var ua = navigator.userAgent.toLowerCase();
    if(ua.match(/MicroMessenger/i)=="micromessenger") {
    return true;
    } else {
    return false;
    }
    }
    function panduan(urls){
    if(Is_weixn()){
    
    window.location.href = urls["weixin"];
    
    }else if(IsPC()){
    
    window.location.href = urls["pc"];
    
    }else{
    
    window.location.href = urls["shouji"];
    
    }
    }
    var urls = new Array();
    
    urls["weixin"] = "http://www.baidu.com";
    urls["shouji"] = "http://www.baidu.com";
    urls["pc"] = "http://www.baidu.com";
    
    panduan(urls);

    其它相关链接

    Js判断客户端是否为PC还是手持移动设备

    正因为来之不易,所以才有了后来的倍加珍惜。
  • 相关阅读:
    poj3255,poj2449
    poj2186
    poj3249
    poj3378
    poj3274
    poj1948
    hdu 2181暴搜
    hdu 3342
    hdu 1285
    hdu 1598
  • 原文地址:https://www.cnblogs.com/jjxhp/p/8696170.html
Copyright © 2020-2023  润新知