var u = navigator.userAgent;
if(u.indexOf("miniProgram") != -1){
//在微信小程序
}else {
//在微信网页
}