
By reading the browser User-Agent and checking for "micromessenger", you can detect whether the page is opened inside WeChat''s built-in browser.
First read the browser UA and check whether it contains micromessenger. The function:
function isWeiXin(){
var ua = window.navigator.userAgent.toLowerCase();
if(ua.match(/MicroMessenger/i) == 'micromessenger'){
return true;
}else{
return false;
}
}Call it wherever needed:
if(isWeiXin()){ // show DOM if inside WeChat client
$('.store-apply').show();
}