1、根据User-Agent判断

// Js获取User-Agent 
window.navigator.userAgent 
 
if(window.navigator.userAgent.match(/MicroMessenger/i) == "micromessenger") 
 
// Php获取User-Agent 
echo $_SERVER['HTTP_USER_AGENT']; 
 
if(strpos($_SERVER['HTTP_USER_AGENT'],'MicroMessenger')==true) 
 
// 微信内部打开获取到的User-Agent 
Mozilla/5.0 (Linux; U; Android 5.0.2; zh-cn; MI 2S Build/LRX22G) AppleWebKit/533.1 (KHTML, like Gecko)Version/4.0 MQQBrowser/5.4 TBS/025488 Mobile Safari/533.1 MicroMessenger/6.3.9.48_refecd3e.700 NetType/WIFI Language/zh_CN 

 
2、Url地址判断

// 你网页正常的url是 
https://forum.xxx.com/home.php"htmlcode">
! function(a, b) {
  "function" == typeof define && (define.amd || define.cmd) "sha1", a.verifyTimestamp = E.timestamp + "", a.verifyNonceStr = E.nonceStr, a.verifySignature = E.signature, a
  }

  function f(a) {
    return {
      timeStamp: a.timestamp + "",
      nonceStr: a.nonceStr,
      "package": a.package,
      paySign: a.paySign,
      signType: a.signType || "SHA1"
    }
  }

  function g(a, b, c) {
    var d, e, f;
    switch (delete b.err_code, delete b.err_desc, delete b.err_detail, d = b.errMsg, d || (d = b.err_msg, delete b.err_msg, d = h(a, d), b.errMsg = d), c = c || {}, c._complete && (c._complete(b), delete c._complete), d = b.errMsg || "", E.debug && !c.isInnerInvoke && alert(JSON.stringify(b)), e = d.indexOf(":"), f = d.substring(e + 1)) {
      case "ok":
        c.success && c.success(b);
        break;
      case "cancel":
        c.cancel && c.cancel(b);
        break;
      default:
        c.fail && c.fail(b)
    }
    c.complete && c.complete(b)
  }

  function h(a, b) {
    var e, f, c = a,
      d = p[c];
    return d && (c = d), e = "ok", b && (f = b.indexOf(":"), e = b.substring(f + 1), "confirm" == e && (e = "ok"), "failed" == e && (e = "fail"), -1 != e.indexOf("failed_") && (e = e.substring(7)), -1 != e.indexOf("fail_") && (e = e.substring(5)), e = e.replace(/_/g, " "), e = e.toLowerCase(), ("access denied" == e || "no permission to execute" == e) && (e = "permission denied"), "config" == c && "function not exist" == e && (e = "ok"), "" == e && (e = "fail")), b = c + ":" + e
  }

  function i(a) {
    var b, c, d, e;
    if (a) {
      for (b = 0, c = a.length; c > b; ++b) d = a[b], e = o[d], e && (a[b] = e);
      return a
    }
  }

  function j(a, b) {
    if (!(!E.debug || b && b.isInnerInvoke)) {
      var c = p[a];
      c && (a = c), b && b._complete && delete b._complete, console.log('"' + a + '",', b || "")
    }
  }

  function k() {
    0 != D.preVerifyState && (u || v || E.debug || "6.0.2" > z || D.systemType < 0 || A || (A = !0, D.appId = E.appId, D.initTime = C.initEndTime - C.initStartTime, D.preVerifyTime = C.preVerifyEndTime - C.preVerifyStartTime, H.getNetworkType({
      isInnerInvoke: !0,
      success: function(a) {
        var b, c;
        D.networkType = a.networkType, b = "http://open.weixin.qq.com/sdk/report" + D.version + "&o=" + D.preVerifyState + "&s=" + D.systemType + "&c=" + D.clientVersion + "&a=" + D.appId + "&n=" + D.networkType + "&i=" + D.initTime + "&p=" + D.preVerifyTime + "&u=" + D.url, c = new Image, c.src = b
      }
    })))
  }

  function l() {
    return (new Date).getTime()
  }

  function m(b) {
    w && (a.WeixinJSBridge "WeixinJSBridgeReady", b, !1))
  }

  function n() {
    H.invoke || (H.invoke = function(b, c, d) {
      a.WeixinJSBridge && WeixinJSBridge.invoke(b, e(c), d)
    }, H.on = function(b, c) {
      a.WeixinJSBridge && WeixinJSBridge.on(b, c)
    })
  }
  var o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H;
  if (!a.jWeixin) return o = {
    config: "preVerifyJSAPI",
    onMenuShareTimeline: "menu:share:timeline",
    onMenuShareAppMessage: "menu:share:appmessage",
    onMenuShareQQ: "menu:share:qq",
    onMenuShareWeibo: "menu:share:weiboApp",
    onMenuShareQZone: "menu:share:QZone",
    previewImage: "imagePreview",
    getLocation: "geoLocation",
    openProductSpecificView: "openProductViewWithPid",
    addCard: "batchAddCard",
    openCard: "batchViewCard",
    chooseWXPay: "getBrandWCPayRequest"
  }, p = function() {
    var b, a = {};
    for (b in o) a[o[b]] = b;
    return a
  }(), q = a.document, r = q.title, s = navigator.userAgent.toLowerCase(), t = navigator.platform.toLowerCase(), u = !(!t.match("mac") && !t.match("win")), v = -1 != s.indexOf("wxdebugger"), w = -1 != s.indexOf("micromessenger"), x = -1 != s.indexOf("android"), y = -1 != s.indexOf("iphone") || -1 != s.indexOf("ipad"), z = function() {
    var a = s.match(/micromessenger\/(\d+\.\d+\.\d+)/) || s.match(/micromessenger\/(\d+\.\d+)/);
    return a ""
  }(), A = !1, B = !1, C = {
    initStartTime: l(),
    initEndTime: 0,
    preVerifyStartTime: 0,
    preVerifyEndTime: 0
  }, D = {
    version: 1,
    appId: "",
    initTime: 0,
    preVerifyTime: 0,
    networkType: "",
    preVerifyState: 1,
    systemType: y "config", a);
      var b = E.check === !1 "6.0.2" > z || B || (B = !0, -1 == G.state "checkJsApi", {
        jsApiList: i(a.jsApiList)
      }, function() {
        return a._complete = function(a) {
          if (x) {
            var c = a.checkResult;
            c && (a.checkResult = JSON.parse(c))
          }
          a = b(a)
        }, a
      }())
    },
    onMenuShareTimeline: function(a) {
      d(o.onMenuShareTimeline, {
        complete: function() {
          c("shareTimeline", {
            title: a.title || r,
            desc: a.title || r,
            img_url: a.imgUrl || "",
            link: a.link || location.href,
            type: a.type || "link",
            data_url: a.dataUrl || ""
          }, a)
        }
      }, a)
    },
    onMenuShareAppMessage: function(a) {
      d(o.onMenuShareAppMessage, {
        complete: function() {
          c("sendAppMessage", {
            title: a.title || r,
            desc: a.desc || "",
            link: a.link || location.href,
            img_url: a.imgUrl || "",
            type: a.type || "link",
            data_url: a.dataUrl || ""
          }, a)
        }
      }, a)
    },
    onMenuShareQQ: function(a) {
      d(o.onMenuShareQQ, {
        complete: function() {
          c("shareQQ", {
            title: a.title || r,
            desc: a.desc || "",
            img_url: a.imgUrl || "",
            link: a.link || location.href
          }, a)
        }
      }, a)
    },
    onMenuShareWeibo: function(a) {
      d(o.onMenuShareWeibo, {
        complete: function() {
          c("shareWeiboApp", {
            title: a.title || r,
            desc: a.desc || "",
            img_url: a.imgUrl || "",
            link: a.link || location.href
          }, a)
        }
      }, a)
    },
    onMenuShareQZone: function(a) {
      d(o.onMenuShareQZone, {
        complete: function() {
          c("shareQZone", {
            title: a.title || r,
            desc: a.desc || "",
            img_url: a.imgUrl || "",
            link: a.link || location.href
          }, a)
        }
      }, a)
    },
    startRecord: function(a) {
      c("startRecord", {}, a)
    },
    stopRecord: function(a) {
      c("stopRecord", {}, a)
    },
    onVoiceRecordEnd: function(a) {
      d("onVoiceRecordEnd", a)
    },
    playVoice: function(a) {
      c("playVoice", {
        localId: a.localId
      }, a)
    },
    pauseVoice: function(a) {
      c("pauseVoice", {
        localId: a.localId
      }, a)
    },
    stopVoice: function(a) {
      c("stopVoice", {
        localId: a.localId
      }, a)
    },
    onVoicePlayEnd: function(a) {
      d("onVoicePlayEnd", a)
    },
    uploadVoice: function(a) {
      c("uploadVoice", {
        localId: a.localId,
        isShowProgressTips: 0 == a.isShowProgressTips "downloadVoice", {
        serverId: a.serverId,
        isShowProgressTips: 0 == a.isShowProgressTips "translateVoice", {
        localId: a.localId,
        isShowProgressTips: 0 == a.isShowProgressTips "chooseImage", {
        scene: "1|2",
        count: a.count || 9,
        sizeType: a.sizeType || ["original", "compressed"],
        sourceType: a.sourceType || ["album", "camera"]
      }, function() {
        return a._complete = function(a) {
          if (x) {
            var b = a.localIds;
            b && (a.localIds = JSON.parse(b))
          }
        }, a
      }())
    },
    previewImage: function(a) {
      c(o.previewImage, {
        current: a.current,
        urls: a.urls
      }, a)
    },
    uploadImage: function(a) {
      c("uploadImage", {
        localId: a.localId,
        isShowProgressTips: 0 == a.isShowProgressTips "downloadImage", {
        serverId: a.serverId,
        isShowProgressTips: 0 == a.isShowProgressTips "getNetworkType:ok", c = a.subtype, delete a.subtype, c) a.networkType = c;
        else switch (d = b.indexOf(":"), e = b.substring(d + 1)) {
          case "wifi":
          case "edge":
          case "wwan":
            a.networkType = e;
            break;
          default:
            a.errMsg = "getNetworkType:fail"
        }
        return a
      };
      c("getNetworkType", {}, function() {
        return a._complete = function(a) {
          a = b(a)
        }, a
      }())
    },
    openLocation: function(a) {
      c("openLocation", {
        latitude: a.latitude,
        longitude: a.longitude,
        name: a.name || "",
        address: a.address || "",
        scale: a.scale || 28,
        infoUrl: a.infoUrl || ""
      }, a)
    },
    getLocation: function(a) {
      a = a || {}, c(o.getLocation, {
        type: a.type || "wgs84"
      }, function() {
        return a._complete = function(a) {
          delete a.type
        }, a
      }())
    },
    hideOptionMenu: function(a) {
      c("hideOptionMenu", {}, a)
    },
    showOptionMenu: function(a) {
      c("showOptionMenu", {}, a)
    },
    closeWindow: function(a) {
      a = a || {}, c("closeWindow", {}, a)
    },
    hideMenuItems: function(a) {
      c("hideMenuItems", {
        menuList: a.menuList
      }, a)
    },
    showMenuItems: function(a) {
      c("showMenuItems", {
        menuList: a.menuList
      }, a)
    },
    hideAllNonBaseMenuItem: function(a) {
      c("hideAllNonBaseMenuItem", {}, a)
    },
    showAllNonBaseMenuItem: function(a) {
      c("showAllNonBaseMenuItem", {}, a)
    },
    scanQRCode: function(a) {
      a = a || {}, c("scanQRCode", {
        needResult: a.needResult || 0,
        scanType: a.scanType || ["qrCode", "barCode"]
      }, function() {
        return a._complete = function(a) {
          var b, c;
          y && (b = a.resultStr, b && (c = JSON.parse(b), a.resultStr = c && c.scan_code && c.scan_code.scan_result))
        }, a
      }())
    },
    openProductSpecificView: function(a) {
      c(o.openProductSpecificView, {
        pid: a.productId,
        view_type: a.viewType || 0,
        ext_info: a.extInfo
      }, a)
    },
    addCard: function(a) {
      var e, f, g, h, b = a.cardList,
        d = [];
      for (e = 0, f = b.length; f > e; ++e) g = b[e], h = {
        card_id: g.cardId,
        card_ext: g.cardExt
      }, d.push(h);
      c(o.addCard, {
        card_list: d
      }, function() {
        return a._complete = function(a) {
          var c, d, e, b = a.card_list;
          if (b) {
            for (b = JSON.parse(b), c = 0, d = b.length; d > c; ++c) e = b[c], e.cardId = e.card_id, e.cardExt = e.card_ext, e.isSuccess = e.is_succ "chooseCard", {
        app_id: E.appId,
        location_id: a.shopId || "",
        sign_type: a.signType || "SHA1",
        card_id: a.cardId || "",
        card_type: a.cardType || "",
        card_sign: a.cardSign,
        time_stamp: a.timestamp + "",
        nonce_str: a.nonceStr
      }, function() {
        return a._complete = function(a) {
          a.cardList = a.choose_card_info, delete a.choose_card_info
        }, a
      }())
    },
    openCard: function(a) {
      var e, f, g, h, b = a.cardList,
        d = [];
      for (e = 0, f = b.length; f > e; ++e) g = b[e], h = {
        card_id: g.cardId,
        code: g.code
      }, d.push(h);
      c(o.openCard, {
        card_list: d
      }, a)
    },
    chooseWXPay: function(a) {
      c(o.chooseWXPay, f(a), a)
    }
  }, b && (a.wx = a.jWeixin = H), H
});

标签:
JavaScript,微信,js

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com

《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线

暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。

艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。

《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。