function isWeChat(){ var ua = window.navigator.userAgent.toLowerCase(); if(ua.match(/MicroMessenger/i) == 'micromessenger'){ var system = { win: false, mac: false }; //检测平台 var p = navigator.platform; system.win = p.indexOf("Win") == 0; system.mac = p.indexOf("Mac") == 0; if (system.win || system.mac) { alert("在微信PC端上打开内置浏览器"); }else { alert("非微信PC端上打开内置浏览器"); } }