码迷,mamicode.com
首页 > 微信 > 详细

判断是否是微信打开

时间:2019-04-30 14:11:13      阅读:169      评论:0      收藏:0      [点我收藏+]

标签:false   exp   ade   func   author   new   nes   nav   https   

$(window).load(function () {

    var isweixin = is_weixin();
    if (isweixin) {
        var guid = GetQueryString("itemId");
        window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx7359c49ea4a34c8f&redirect_uri=http%3a%2f%2fwxyyb.biotecan.com%2fxuexi%2findex.php%2fHome%2fProductDetail%2fproductdetail%2fproductDetail%2f" +
        guid + ‘.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect‘;


    }
    $(‘body‘).addClass(‘loaded‘);
    $(‘#loader-wrapper‘).remove();

});

//获取链接参数
function GetQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]); return null;
}
function is_weixin() {
    var ua = window.navigator.userAgent.toLowerCase();
    if (ua.match(/MicroMessenger/i) == "micromessenger") {   //判断是否是微信打开
        return true;
    } else {
        return false;
    }

 

判断是否是微信打开

标签:false   exp   ade   func   author   new   nes   nav   https   

原文地址:https://www.cnblogs.com/quitpoison/p/10795470.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!